Syntax
help([object])
显示 帮助信息 。
Test
# coding=utf-8
print(help('os')) # 打印 os 模块 帮助信息
"""
Help on module os:
NAME
os - OS routines for NT or Posix depending on what system we're on.
MODULE REFERENCE
https://docs.python.org/3.6/library/os
...
DESCRIPTION
...
"""
print(help('int')) # 打印 int 类型 帮助信息
"""
Help on class int in module builtins:
class int(object)
| int(x=0) -> integer
| int(x, base=10) -> integer
|
...
"""
print(help([10, 20, 30])) # 打印 list 类型 帮助信息
"""
Help on list object:
class list(object)
| list() -> new empty list
| list(iterable) -> new list initialized from iterable's items
|
| Methods defined here:
|
| __add__(self, value, /)
| Return self+value.
...
"""
print(help([10, 20, 30].append)) # 打印 list 类型 的 append方法 帮助信息
"""
Help on built-in function append:
append(...) method of builtins.list instance
L.append(object) -> None -- append object to end
None
"""