vch wrote: > Does a call to file.readlines() reads all lines at once in the memory? > Are the any reasons, from the performance point of view, to prefer > *while* loop with readline() to *for* loop with readlines()?
Yes, and you just mentioned it. .readlines reads the entire file into memory at once, which can obviously be expensive if the file is large. A for loop with .readline, of course, will work, but modern versions of Python allow iteration over a file, which will read it line by line: for line in aFile: ... -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis A wise man never loses anything if he have himself. -- Montaigne -- http://mail.python.org/mailman/listinfo/python-list