时间:2021-07-01 10:21:17 帮助过:518人阅读
代码如下:
>>> help('dir')
Help on built-in function dir in module builtins:
dir(...)
dir([object]) -> list of strings
If called without an argument, return the names in the current scope.
Else, return an alphabetized list of names comprising (some of) the attribut
es
of the given object, and of attributes reachable from it.
If the object supplies a method named __dir__, it will be used; otherwise
the default dir() logic is used and returns:
for a module object: the module's attributes.
for a class object: its attributes, and recursively the attributes
of its bases.
for any other object: its attributes, its class's attributes, and
recursively the attributes of its class's base classes.
三、使用help函数查看帮助实例
在写help()函数使用方法时说过,括号中填写参数,那在这里要注意参数的形式:
1、查看一个模块的帮助
代码如下:
>>>help('sys')
代码如下:
>>>help('str')
代码如下:
>>>a = [1,2,3]
>>>help(a)
代码如下:
>>>help(a.append)