首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >如何通过命令查看python中的所有内置函数和内置常量

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

作者头像
用户7886150
修改2021-01-11 10:14:58
修改2021-01-11 10:14:58
2.6K0
举报
文章被收录于专栏:bit哲学院bit哲学院

参考链接: Python中的id函数

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

举例python版本:  利用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)

ps: 本人热爱图灵,热爱中本聪,热爱V神,热爱一切被梨花照过的姑娘。 以下是我个人的公众号,如果有技术问题可以关注我的公众号来跟我交流。 同时我也会在这个公众号上每周更新我的原创文章,喜欢的小伙伴或者老伙计可以支持一下! 如果需要转发,麻烦注明作者。十分感谢!  公众号名称:后现代泼痞浪漫主义奠基人

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档