如何列出所有内容?
正如列出所有关键字一样:
python
import keyword
keyword.kwlist
是否可以列出所有68个功能?
这是我关于SO的第一个问题,请注意它绝对不会与stackoverflow甚至全世界的现有内容重复。
答案 0 :(得分:5)
这将显示所有内置组件:
>>> dir(__builtins__)
['ArithmeticError', 'AssertionError', ..., 'type', 'vars', 'zip']
答案 1 :(得分:0)
class BuiltinFunctions_42:
def __init__(self):
self.in = ['input']
self.file = ['open']
self.number = ['hex', 'oct', 'abs', 'round', 'divmod', 'pow', 'sum']
self.string = ['format', 'ord', 'chr', 'ascii', 'bin']
self.obj = ['id']
self.sequence = ['hash', 'len', 'max', 'min']
self.iterator = ['all', 'any','iter', 'next']
self.function = ['callable']
self.code = ['eval', 'exec', 'compile']
self.klass = ['__build_class__', 'issubclass']
self.instance = ['repr','isinstance', 'hasattr', 'getattr', 'setattr', 'delattr']
self.module = ['__import__']
self.dubug = {'introspection':{'locals', 'globals'}}
self.out = ['print', 'dir', 'vars']