while loop with f.readline()
Phlip
phlip_cpp at my-deja.com
Wed Feb 14 00:15:14 EST 2001
Proclaimed Chris Gonnerman from the mountaintops:
> I have always been a fan of the FileReader class:
>
> class FileReader:
> def __init__(self, file):
> self.file = file
> def next(self):
> self.line = self.file.readline()
> return self.line
>
> if __name__ == '__main__':
>
> f = FileReader(open("c:/autoexec.bat"))
>
> while f.next():
> print f.line,
Came to the thread late can't read all posts don't know if this was covered
so sue me but...
...what's wrong with this?
for z in f.readlines():
print z
That's how I done it since I was a chile'.
--
Phlip phlip_cpp at my-deja.com
============ http://c2.com/cgi/wiki?PhlIp ============
-- http://www.deja.com/my/pb.xp?member_name=phlip_cpp --
More information about the Python-list
mailing list