2014-04-03 13 views
1

我正在嘗試使用help()函數查看Python Idle中的文件處理函數文檔。如何使用Python 3中的幫助函數查看文件處理函數文檔?

到目前爲止,我已經做了,得到了以下幾點:

>>> fh = open('file.txt', 'w') 
>>> help(fh.seek) 
Help on built-in function seek: 

seek(...) 

我怎樣才能得到的文件?

+0

只是在網上看? – sshashank124

+0

@ sshashank124嗯,我可以,但爲什麼''help()''函數沒有顯示它完成。 –

+0

我從''__doc__''獲得''none'' –

回答

1
>>> import io 
>>> help(io.FileIO.seek) 

返回:

Help on method_descriptor: 

seek(...) 
    seek(offset: int[, whence: int]) -> 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). 
    Note that not all file objects are seekable. 
(END) 

(Python的3.4.0)