Mailing List Archive

Project for newbie
Hi

I've read my way through the tutorial, and am now stuck - where do I go
from here? I want to learn how to use Python, but don't have any
pressing projects at the moment - can anyone suggest a program I should
have a go at writing, to help me learn the language further?

TIA

--
Pete

morph@softhome.net
----------------------------------------------------------------
Linux Registered User # 100652 - Uptime 100 hours, and counting...

-- A Bugless Program is an Abstract Theoretical Concept. --
Project for newbie [ In reply to ]
Pete Jewell writes:
>I've read my way through the tutorial, and am now stuck - where do I go
>from here? I want to learn how to use Python, but don't have any
>pressing projects at the moment - can anyone suggest a program I should
>have a go at writing, to help me learn the language further?

Having third parties provide ideas usually doesn't result in
anything interesting. I have a list of projects on my Web page, but
they're all extremely unlikely to appeal to anyone who isn't me (and
even I'm a bit cool on some of them).

It's much better to ask what are you interested in. GUIs?
You could write a simple game or application with Tkinter, Swing, GTk,
or whatever toolkit you want to learn, or join an existing effort like
PyRPG. Command-line stuff? Perhaps there's some system
administration script you could write; for example, I have a PPP
startup script for my own use; maybe there's something you do often
that could be automated.

--
A.M. Kuchling http://starship.python.net/crew/amk/
When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.
-- Anonymous
Project for newbie [ In reply to ]
In article <70alf7.qc6.ln@loopback>, morph@softhome.net wrote:
>
> I've read my way through the tutorial, and am now stuck - where do I go
> from here? I want to learn how to use Python, but don't have any
> pressing projects at the moment - can anyone suggest a program I should
> have a go at writing, to help me learn the language further?


What about this little problem, assuming you're
interested in internet programming and keen to get
familiar with the Python XML module...? ;-)

Have fun,

Dinu



Context:

The Altavista babelfish returns the following result
page (see appendix below) after issuing this request:

"translate 'water' from English to French"

on that WWW page:

http://babelfish.altavista.com

Some quick testing reveales that you can do the same
with just typing the following (wrapped) URL in your
browser:

http://babelfish.altavista.com/cgi-bin/translate?
doit=done&urltext=water&lp=en_fr

Exercise 1:

Write a program babelfish.py calling the Altavista
Babelfish over the WWW (using httplib, say) and parse
its HTML output using your favorite HTML/XML parser
(suggestion: use the XML module written by the Python
XML-SIG) in order to extract the result and print it
nicely in a terminal window like this:

l'eau

Exercise 2:

Improve your program by allowing multiple words to
be translated in a row, like this (you'll have to
send multiple requests as Babelfish will try to
treat your words as a sentence):

spam
oeufs

Appendix: Sample Babelfish output
(see context description)

<html> <head><title>AltaVista: Translations</title> </head> <body
bgcolor=#ffffff text=#000000 link=#003399 vlink=#663366 alink=#ff0000> <MAP
NAME=header> <AREA SHAPE=RECT COORDS="144,0,323,32"
HREF="http://babelfish.altavista.com/cgi-bin/translate?" ALT="AltaVista
Maps"> <AREA SHAPE=RECT COORDS="0,0,128,32"
HREF="http://www.altavista.com/cgi-bin/query" alt="AltaVista Home"> </MAP>
<center><table width=600 border=0 cellspacing=0 cellpadding=0> <tr><td> <img
src=/gifs/new.babelfish_head.gif border=0 NAME="AltaVista Translation"
WIDTH=383 HEIGHT=32 USEMAP=#header ALT="AltaVista Translation"></td><td
align=right valign=bottom> <font face=arial,helvetica size=-1> <a
href="/content/help.htm">Help</a> - <a
href=http://www.altavista.com/cgi-bin/query>AltaVista Home</a></font>
</td></tr> <tr><td colspan=2 BGCOLOR=#003399><img
src=http://www.altavista.com/av/gifs/pixel.gif border=0 width=0
height=2></td></tr> </table> <table border=0 width=600 cellspacing=0
cellpadding=2><tr><td><table width=100% bgcolor=#ffffff cellpadding=5
cellspacing=0 border=0> <tr><td align=center valign=center><ilayer id=ad1
visibility=hidden height=83></ilayer> <nolayer><iframe
src="http://ad.doubleclick.net/adi/babelfish.altavista.digital.com/"
width=500 height=83 marginwidth=0 marginheight=0 hspace=0 vspace=0
frameborder=0 scrolling=no bordercolor="#000000"><A
href="http://ad.doubleclick.net/jump/babelfish.altavista.digital.com/"
alt="Click Here"><img
src="http://ad.doubleclick.net/ad/babelfish.altavista.digital.com/" width=468
height=60 border=0 ismap><br><font size=-1 face=Arial,Helvetica><b>Click
Here</b></font></a></iframe></nolayer></td></tr></table></td></tr></table>

<table border=0 cellspacing=0 cellpadding=0 width=600 BGCOLOR=#FFCC66>
<TR><td width=2><br></td><td><table border=0 cellspacing=0 cellpadding=4
width=596 BGCOLOR=WHITE>
<tr><td colspan=2 align=left BGCOLOR=#FFCC66><b>

<font face="arial, helvetica">En Français:</b></font>
</td></tr>
<tr><td><img border=0 src="/gifs/clear.gif" width="15" height="0"></td>
<td align="left"><br>

<font face="arial, helvetica">l'eau
<br><br></font></td></tr>
<tr><td align=right colspan=2>
<font face="arial, helvetica" size=-1><a
href="http://altavista.digital.com/cgi-bin/query?q=l%27eau&kl=fr">
<font size=-1>Use the above text to search the
Web</font></a></font></td></tr></table></td><td
width=2><br></td></tr></table><table border=0 cellpadding=0 cellspacing=0
width=600 bgcolor=#ffcc66><tr><td align=center><table border=0 cellpadding=4
cellspacing=0 width="100" bgcolor=#ffcc66><form action="/cgi-bin/translate?"
method="POST">
<input type="hidden" name="doit" value="done">

<tr><td align=left valign=bottom><font size="-1" face="arial,
helvetica"><b>To translate, type <a href="/content/help.htm#trans_text">plain
text</a> or the <a href="/content/help.htm#trans_web">address (URL)</a> of a
Web page here:</b></font></td></tr> <tr><td align=left><textarea rows="6"
wrap=virtual cols="56" name="urltext">water</textarea></td></tr> <tr><td
align=left valign=top> <font size="-1" face="arial, helvetica"><B>Translate
from: <select name="lp"> <option value="en_fr" SELECTED>English to
French</option> <option value="en_de" >English to German</option> <option
value="en_it" >English to Italian</option> <option value="en_pt" >English
to Portuguese</option> <option value="en_es" >English to Spanish</option>
<option value="fr_en" >French to English</option> <option value="de_en"
>German to English</option> <option value="it_en" >Italian to
English</option> <option value="es_en" >Spanish to English</option> <option
value="pt_en" >Portuguese to English</option> </select> <input type="Submit"
value="Translate"></b></font> </td></tr></form></table> </td></tr></table>
<table width=600 cellpadding=0 cellspacing=0 border=0> <tr
bgcolor="#ffcc66"><td align=center><font size=-1 face="arial,helvetica"><br>
Put the power of Babel Fish into IE 5. <b><a
href="http://www.altavista.com/av/avie5/avtools.html">Get AV Power Tools<b>
(119k)</a><p> <b><a href="http://www.systransoft.com/personal.html">Download
SYSTRAN Personal</a> and translate your private documents in
seconds.</font></b><br><br></td></tr> <tr><td bgcolor=#003399 width=100%><img
src="http://altavista.com/av/gifs/pixel.gif" border=0 width=0
height=2></td></tr> </table> <table width=600 border=0 cellspacing=0
cellpadding=4> <tr><td width=440 align=left><font size=-2
face="arial,helvetica"> <a
href="http://altavista.com/cgi-bin/query">AltaVista Home</a> | <a
href="/content/help.htm">Help</a> | <a
href="/content/feedback.htm">Feedback</a> <BR> &copy;1995-98 | <a
href="http://altavista.com/av/content/disclaimer.htm">Disclaimer</a> | <a
href="http://altavista.com/av/content/privacy.htm">Privacy</a> | <a
href="http://jump.altavista.com/DoubleClick">Advertising Info</a></font></td>
<td valign=middle align=right width=160> <a
href="http://www.systransoft.com/"><IMG SRC="/gifs/systran_big_logo.gif"
WIDTH="138" HEIGHT="39" BORDER="0"></a> </td></tr></table> </center> <layer
src="http://ad.doubleclick.net/adl/babelfish.altavista.digital.com/"
visibility=hidden id=a1 width=590
onload="moveToAbsolute(ad1.pageX,ad1.pageY);
a1.clip.height=83;visibility='show';"></layer> </BODY></HTML>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Project for newbie [ In reply to ]
In article <14110.12533.232498.655489@amarok.cnri.reston.va.us>,
Andrew M. Kuchling wrote:
>Pete Jewell writes:
>>I've read my way through the tutorial, and am now stuck - where do I go
>>from here? I want to learn how to use Python, but don't have any
>>pressing projects at the moment - can anyone suggest a program I should
>>have a go at writing, to help me learn the language further?
>
> Having third parties provide ideas usually doesn't result in
>anything interesting. I have a list of projects on my Web page, but
>they're all extremely unlikely to appeal to anyone who isn't me (and
>even I'm a bit cool on some of them).
>
For what it's worth, my first project (5ish months ago) was an internet-utility
type thing: opening/closing connection, timing the period online, getting a
list of mail waiting for me, telling me when I've stopped getting news etc.
My second one was for work doing the same sort of thing over a telnet
connection. Then several simple text filtering/processing utilities, and
I'm now doing something that started life as an addressbook (storing in a
database) but has now got rather more ambitious.

What did everyone else do?


--
Glenn the Gazelle
Project for newbie [ In reply to ]
In article <slrn7hv1kj.ee.glenn@gacela.demon.co.uk>,
glenn@gacela.demon.co.uk (Glenn Rogers) writes:
GR> In article <14110.12533.232498.655489@amarok.cnri.reston.va.us>,
GR> Andrew M. Kuchling wrote:
>>Pete Jewell writes:
>>>I've read my way through the tutorial, and am now stuck - where do I go
>>>from here? I want to learn how to use Python, but don't have any
>>>pressing projects at the moment - can anyone suggest a program I should
>>>have a go at writing, to help me learn the language further?
>>
>> Having third parties provide ideas usually doesn't result in
>>anything interesting. I have a list of projects on my Web page, but
>>they're all extremely unlikely to appeal to anyone who isn't me (and
>>even I'm a bit cool on some of them).
>>
GR> For what it's worth, my first project (5ish months ago) was
GR> an internet-utility type thing: opening/closing connection,
GR> timing the period online, getting a list of mail waiting for me,
GR> telling me when I've stopped getting news etc.
GR> My second one was for work doing the same sort of thing over a
GR> telnet connection. Then several simple text filtering/
GR> processing utilities, and I'm now doing something that started
GR> life as an addressbook (storing in a database) but has now
GR> got rather more ambitious.
GR>
GR> What did everyone else do?
GR>
GR>

I'm still at the tiny scripts stage - this is why I like python :-) -

#!/usr/local/bin/python
# 'sendnntp.py' v0.0.1
# send the contents of stdin to the nntphost localhost

from nntplib import *

server = NNTP('localhost')
messagepipe = open('/dev/stdin','r')
server.post(messagepipe)

server.quit()

I'm using this in combination with procmail/formail to gate posts
to a newsgroup via an email address (strictly controlled). Thanks
for the suggestions though :-)

--
Pete

morph@softhome.net
----------------------------------------------------------------
Linux Registered User # 100652 - Uptime 25 hours, and counting...

-- If I can't fix it, it's probably a dead norwegian blue. --