我想打开一个文件并使用 and 读取每一f.seek()
行f.tell()
:
测试.txt:
abc
def
ghi
jkl
我的代码是:
f = open('test.txt', 'r')
last_pos = f.tell() # get to know the current position in the file
last_pos = last_pos + 1
f.seek(last_pos) # to change the current position in a file
text= f.readlines(last_pos)
print text
它读取整个文件。