经过查找N多文档,得到一种很隐晦的说法是当返回空串时表示退出。 于是写法是: fp = .... while True: line = fp.readline() if len(line)==0: break # ...
確定! 回上一頁