Computer >> Máy Tính >  >> Lập trình >> Python

Hàm trợ giúp trong Python

Nhiều khi chúng ta cần xem xét tài liệu python để được trợ giúp về các hàm, mô-đun, v.v. Python cung cấp một hàm trợ giúp cung cấp cho chúng ta kết quả cần thiết này.

Cú pháp

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

Ví dụ

Trong ví dụ dưới đây, chúng tôi tìm kiếm trợ giúp về thời gian từ. Đầu ra đến từ tài liệu python và nó khá đầy đủ.

print(help('time'))

Đầu ra

Chạy đoạn mã trên cho chúng ta kết quả sau -

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).
……………………….