Python 中的幫助功能


很多時候我們需要檢視 python 文件來獲得有關函式、模組等方面的部分幫助。Python 提供了一個幫助我們獲得這些必需結果的幫助函式。

語法

Help(‘term’)
Where term is the word on which we want the help.

示例

在以下示例中,我們試圖獲取有關 time 關鍵字的幫助。輸出來自 Python 文件,非常詳盡。

 線上演示

print(help('time'))

輸出

執行上述程式碼將為我們提供以下結果 −

Help on built-in module time:
NAME
time - This module provides various functions to manipulate time values.

DESCRIPTION
There are two standard representations of time. One is the number
of seconds since the Epoch, in UTC (a.k.a. GMT). It may be an integer
or a floating point number (to represent fractions of seconds).
The Epoch is system-defined; on Unix, it is generally January 1st, 1970.
The actual value can be retrieved by calling gmtime(0).
……………………….

更新日期:23-08-2019

187 次瀏覽

開啟你的 職業生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.