标签:
fp = open(‘somefile.txt‘) while True: line = fp.readline() if not line: break
Python中,空串的not返回true,即not line时为读到EOF(文件末尾)
python中判断readline读到文件末尾
原文地址:http://www.cnblogs.com/summerkiki/p/4472043.html