二十五岁时我们都一样愚蠢、多愁善感,喜欢故弄玄虚,可如果不那样的话,五十岁时也就不会如此明智。
标题:Python3 文件File位置
Python3 文件File位置
#!/usr/bin/python3 # Open a file fo = open("foo.txt", "r+") str = fo.read(10) print ("Read String is : ", str) # Check current position position = fo.tell() print ("Current file position : ", position) # Reposition pointer at the beginning once again position = fo.seek(0, 0) str = fo.read(10) print ("Again read String is : ", str) # Close opened file fo.close()