Python有多少个内置函数呢?网上有说63、68和69的,当然,这些数都正确,因为python版本不同,内置函数的数量可能也不同。以发布日期较近的3.10版本来说,内置了77个函数!
import sys
print('当前Pytho的版本为:',sys.version)
list=[item for item in dir(__builtins__) if not item.startswith('__') and item[0].islower() ]
print('内置函数的数量为:',len(list))
print('内置函数的名称为:',list)
返回:
当前Pytho的版本为: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
内置函数的数量为: 77
内置函数的名称为: [‘abs’, ‘aiter’, ‘all’, ‘anext’, ‘any’, ‘ascii’, ‘bin’, ‘bool’, ‘breakpoint’, ‘bytearray’, ‘bytes’, ‘callable’, ‘chr’, ‘classmethod’, ‘compile’, ‘complex’, ‘copyright’, ‘credits’, ‘delattr’, ‘dict’, ‘dir’, ‘display’, ‘divmod’, ‘enumerate’, ‘eval’, ‘exec’, ‘execfile’, ‘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’, ‘runfile’, ‘set’, ‘setattr’, ‘slice’, ‘sorted’, ‘staticmethod’, ‘str’, ‘sum’, ‘super’, ‘tuple’, ‘type’, ‘vars’, ‘zip’]
后续我们就简单介绍一下这些函数的使用方法。
发布者:股市刺客,转载请注明出处:https://www.95sca.cn/archives/75007
站内所有文章皆来自网络转载或读者投稿,请勿用于商业用途。如有侵权、不妥之处,请联系站长并出示版权证明以便删除。敬请谅解!