Hi Alex
Assuming you have a file called "data.txt":
*** f = open('data.txt','r') lines = f.readlines() f.close() for line in lines: print line *** Will print each line of the file.
You can make a huge investment by setting 2 or 3 hours aside to go through the Python tutorial, which gets installed as part of the documentation. That tutorial can get you much of the knowledge you will ever need with Python.
thx Caleb
On 2 Feb 2005 13:27:49 -0800, alex <[EMAIL PROTECTED]> wrote:
Hi,
I am a beginner with python and here is my first question: How can I read the contents of a file using a loop or something? I open the file with file=open(filename, 'r') and what to do then? Can I use something like
for xxx in file: ....
Thanks for help Alex
-- http://mail.python.org/mailman/listinfo/python-list