20 Apr
2006
20 Apr
'06
9:50 a.m.
On Thu, 20 Apr 2006, Eric Emsellem apparently wrote:
############################## for i in range(nlines) : ... ... while i < nlines : .... i += 1 if ... : break #############################
The for loop provides a rule for assignment to the name 'i', so that must fail. Files are iterators: http://docs.python.org/lib/bltin-file-objects.html Use 'for line in file:' along with the next() method. hth, Alan Isaac