Grant Edwards wrote: > On 2007-05-16, walterbyrd <[EMAIL PROTECTED]> wrote: > > >>Python's lack of an EOF character is giving me a hard time. > > > No it isn't. > > >>s = f.readline() >>while s: >>. >>. >>s = f.readline() > > > > >>s = f.readline() >>while s != '' >>. >>. >>s = f.readline() > > > > Neither one of your examples is legal Python. Please post real > code. > > >>In both cases, the loop ends as soon it encounters an empty line in >>the file, i.e. > > > No, it doesn't. Not if you've done something reasonable like > this: > > f = open('testdata','r') > while True: > s = f.readline() > if not s: break > print repr(s) > > or this: > > f = open('testdata','r') > s = f.readline() > while s: > print repr(s) > s = f.readline() > > Please post real, runnable code. You've done something wrong > and we've no way to guess what it was if you won't show us your > code. >
I'm guessing it was runnable when he pasted it into google groups. James -- http://mail.python.org/mailman/listinfo/python-list