Billy Mays <[email protected]> writes: > Is there any way to just create a new generator that clears its > closed` status?
You can define getLines in terms of the readline file method, which does
return new data when it is available.
def getLines(f):
lines = []
while True:
line = f.readline()
if line == '':
break
lines.append(line)
return lines
or, more succinctly:
def getLines(f):
return list(iter(f.readline, ''))
--
http://mail.python.org/mailman/listinfo/python-list
