2016-06-06 回答
你好!
>>> print f.seek.__doc__
seek(offset[, whence]) -> None. Move to new file position.
Argument offset is a byte count. Optional argument whence defaults to
0 (offset from start of file, offset should be >= 0); other values are 1
(move relative to current position, positive or negative), and 2 (move
relative to end of file, usually negative, although many platforms allow
seeking beyond the end of a file). If the file is opened in text mode,
only offsets returned by tell() are legal. Use of other offsets causes
undefined behavior.
Note that not all file objects are seekable.
>>>
f.seek的参数说明如上。
仅代表个人观点,不喜勿喷,谢谢。
追问:
大哥,看不懂啊,能解释下不?
追答:
回答你的问题:
1. whence 的默认参数是0。
所以seek(0)和f.