>>> f = open(r'c:\Movie\test.txt') >>> f.next() 'This is the first line\n' >>> f.next() ' Second line\n' >>> f.readline() Traceback (most recent call last): File "<interactive input>", line 1, in <module> ValueError: Mixing iteration and read methods would lose data >>> f.next() ' third line\n' >>> f.seek(0) >>> f.readline() 'This is the first line\n' >>> f.readlines() [' Second line\n', ' third line\n', ' end']
Mixing iteration and read methods would lose data
最新推荐文章于 2020-12-04 11:43:58 发布