Basic file operation questions

alex alexander.dietz at mpi-hd.mpg.de
Wed Feb 2 16:27:49 EST 2005


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




More information about the Python-list mailing list