小編給大家分享一下查看python文檔的方法,相信大部分人都還不怎么了解,因此分享這邊文章給大家學習,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去學習方法吧!
查看文檔是一個程序員的基本功,這里簡單介紹幾種查看Python文檔的方法,下面以struct模塊為例。
1.help
在交互模式下,help函數是獲取文檔的好幫手,使用非常簡單。
>>> import struct >>> help(struct) Help on module struct: NAME struct DESCRIPTION Functions to convert between Python values and C structs. Python bytes objects are used to hold the data representing the C struct and also as format strings (explained below) to describe the layout of data in the C struct. The optional first format char indicates byte order, size and alignment: @: native order, size & alignment (default) =: native order, std. size & alignment <: little-endian, std. size & alignment >: big-endian, std. size & alignment !: same as > The remaining chars indicate types of args and must match exactly; these can be preceded by a decimal repeat count: x: pad byte (no data); c:char; b:signed byte; B:unsigned byte; ?: _Bool (requires C99; if not available, char is used instead) h:short; H:unsigned short; i:int; I:unsigned int;
2.__doc__
__doc__是每個對象都有的屬性,其存放了對象文檔。
3.離線文檔
安裝Python時會自帶一個chm格式的離線文檔Python documention,該文檔的信息比較全。
4.離線模塊文檔
Python針對模塊還有一個單獨的文檔,該文檔在瀏覽器中查看。
5.在線文檔。
以上是查看python文檔的方法的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。