Thanks Simon,
So the code should look like:
f=open(myfile,"r")
for some_var in f:
text=f.readline()
print text
Do I have this correct ?
Nearly - you don't need the text=f.readline() bit. A file object (as
returned to you by open()) is an iterator, and iterating over it gives
you the lines directly.
Why not give it a go? The nice thing about Python is how easy it is to
try stuff like this out at the interactive prompt. Err, *one* of the
nice things, that is. ;-)
BTW, newbies are more than welcome here, but there is a python-tutor
list[1] which might be more your speed if you are quite new to Python.
There are also a number of tutorials available[2] . I'd recommend
either the standard tutorial[3] or Dive Into Python[4] for someone
like you who already knows how to program but doesn't know Python.
Welcome to Python, and have fun.
--
Cheers,
Simon B,
(e-mail address removed),
http://www.brunningonline.net/simon/blog/
[1]
http://mail.python.org/mailman/listinfo/tutor
[2]
http://www.python.org/moin/BeginnersGuide/Programmers
[3]
http://www.python.org/doc/current/tut/
[4]
http://diveintopython.org/