彩虹七号 发表于 2018-8-10 18:29:31

关于文件对象方法

为什么 f.tell ()在for...in 中不能被append添加到列表中

b = []
>>> for each in f:
        b.append(f.tell())

       
Traceback (most recent call last):
File "<pyshell#51>", line 2, in <module>
    b.append(f.tell())
OSError: telling position disabled by next() call

无符号整形 发表于 2018-8-10 18:31:04

交互模式特有的错误
https://segmentfault.com/q/1010000004629778
页: [1]
查看完整版本: 关于文件对象方法