fp = open("a.txt") #do many things with fp c = fp.read() if c is None: print 'fp is at the eof'
除了上面的方法,任何其他方式来找出是否是fp已经在eof?
python file eof
eof ×1
file ×1
python ×1