python——用好dir()、help()

dir()

语法

dir([object])

返回值

返回模块的属性列表。

>>> dir()#获得当前模块的属性列表
['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'a']
>>> dir(__builtins__)#获得当前模块的所有内置函数

help()

语法

help([object])

返回值

返回对象帮助信息

>>> help(dir)
Help on built-in function dir in module builtins:

猜你喜欢

转载自www.cnblogs.com/lalalaxpf/p/9500702.html