如何查看python有哪些内置函数_如何通过命令查看python中的所有内置函数和内置常量...

举例python版本:

605dcb5b2037

image

利用python中的语句输出python中的所有内置函数及内置常量名:

dir(__builtin__)

输出一个列表:

In [1]: dir(__builtin__)

Out[1]:

['ArithmeticError',

'AssertionError',

'AttributeError',

'BaseException',

'BlockingIOError',

'BrokenPipeError',

'BufferError',

'BytesWarning',

'ChildProcessError',

'ConnectionAbortedError',

'ConnectionError',

'ConnectionRefusedError',

'ConnectionResetError',

'DeprecationWarning',

'EOFError',

'Ellipsis',

'EnvironmentError',

'Exception',

'False',

'FileExistsError',

'FileNotFoundError',

'FloatingPointError',

'FutureWarning',

'GeneratorExit',

'IOError',

'ImportError',

'ImportWarning',

'IndentationError',

'IndexError',

'InterruptedError',

'IsADirectoryError',

'KeyError',

'KeyboardInterrupt',

'LookupError',

'MemoryError',

'ModuleNotFoundError',

'NameError',

'None',

'NotADirectoryError',

'NotImplemented',

'NotImplementedError',

'OSError',

'OverflowError',

'PendingDeprecationWarning',

'PermissionError',

'ProcessLookupError',

'RecursionError',

'ReferenceError',

'ResourceWarning',

'RuntimeError',

'RuntimeWarning',

'StopAsyncIteration',

'StopIteration',

'SyntaxError',

'SyntaxWarning',

'SystemError',

'SystemExit',

'TabError',

'TimeoutError',

'True',

'TypeError',

'UnboundLocalError',

'UnicodeDecodeError',

'UnicodeEncodeError',

'UnicodeError',

'UnicodeTranslateError',

'UnicodeWarning',

'UserWarning',

'ValueError',

'Warning',

'ZeroDivisionError',

'__IPYTHON__',

'__build_class__',

'__debug__',

'__doc__',

'__import__',

'__loader__',

'__name__',

'__package__',

'__spec__',

'abs',

'all',

'any',

'ascii',

'bin',

'bool',

'breakpoint',

'bytearray',

'bytes',

'callable',

'chr',

'classmethod',

'compile',

'complex',

'copyright',

'credits',

'delattr',

'dict',

'dir',

'display',

'divmod',

'enumerate',

'eval',

'exec',

'filter',

'float',

'format',

'frozenset',

'get_ipython',

'getattr',

'globals',

'hasattr',

'hash',

'help',

'hex',

'id',

'input',

'int',

'isinstance',

'issubclass',

'iter',

'len',

'license',

'list',

'locals',

'map',

'max',

'memoryview',

'min',

'next',

'object',

'oct',

'open',

'ord',

'pow',

'print',

'property',

'range',

'repr',

'reversed',

'round',

'set',

'setattr',

'slice',

'sorted',

'staticmethod',

'str',

'sum',

'super',

'tuple',

'type',

'vars',

'zip']

大写字母开头的是python的内置常量名,小写字母开头的是python的内置函数名。

进一步查看内置函数的用法可以:

# help(内置函数名)

help(list)

605dcb5b2037

image

ps:

本人热爱图灵,热爱中本聪,热爱V神,热爱一切被梨花照过的姑娘。

以下是我个人的公众号,如果有技术问题可以关注我的公众号来跟我交流。

同时我也会在这个公众号上每周更新我的原创文章,喜欢的小伙伴或者老伙计可以支持一下!

如果需要转发,麻烦注明作者。十分感谢!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值