溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

python查看文檔的方式有哪些

發(fā)布時間:2020-09-02 14:53:18 來源:億速云 閱讀:211 作者:小新 欄目:編程語言

python查看文檔的方式有哪些?這個問題可能是我們?nèi)粘W習或工作經(jīng)常見到的。希望通過這個問題能讓你收獲頗深。下面是小編給大家?guī)淼膮⒖純?nèi)容,讓我們一起來看看吧!

help

在交互模式下,help函數(shù)是獲取文檔的好幫手,使用非常簡單。

>>> 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;

__doc__

__doc__是每個對象都有的屬性,其存放了對象文檔。

>>> import struct
>>> struct.__doc__
"Functions to convert between Python values and C structs.\nPython bytes objects are used to hold the data representing the C struct\nand also as format string
s (explained below) to describe the layout of data\nin the C struct.\n\nThe optional first format char indicates byte order, size and alignment:\n  @: native o
rder, size & alignment (default)\n  =: native order, std. size & alignment\n  <: little-endian, std. size & alignment\n  >: big-endian, std. size & alignment\n
  !: same as >\n\nThe remaining chars indicate types of args and must match exactly;\nthese can be preceded by a decimal repeat count:\n  x: pad byte (no data)
; c:char; b:signed byte; B:unsigned byte;\n  ?: _Bool (requires C99; if not available, char is used instead)\n  h:short; H:unsigned short; i:int; I:unsigned in
t;\n  l:long; L:unsigned long;

離線文檔

安裝Python時會自帶一個chm格式的離線文檔Python documention,該文檔的信息比較全。

python查看文檔的方式有哪些離線模塊文檔

Python針對模塊還有一個單獨的文檔,該文檔在瀏覽器中查看。

python查看文檔的方式有哪些在線文檔

在瀏覽器打開https://docs.python.org/3.4/

感謝各位的閱讀!看完上述內(nèi)容,你們對python查看文檔的方式有哪些大概了解了嗎?希望文章內(nèi)容對大家有所幫助。如果想了解更多相關文章內(nèi)容,歡迎關注億速云行業(yè)資訊頻道。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI