Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

ฟังก์ชั่นช่วยเหลือใน Python


หลายครั้งที่เราต้องดูเอกสารประกอบของ python เพื่อขอความช่วยเหลือเกี่ยวกับฟังก์ชัน โมดูล ฯลฯ Python มีฟังก์ชันความช่วยเหลือที่ให้ผลลัพธ์ที่จำเป็นนี้แก่เรา

ไวยากรณ์

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

ตัวอย่าง

ในตัวอย่างด้านล่าง เราพยายามค้นหาความช่วยเหลือเกี่ยวกับคำว่า เวลา ผลลัพธ์มาจากเอกสารประกอบของ 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).
……………………….