每日一题100期了,恭喜越办越好!
- import re
- FUNCTION = []
- CLASS = []
- OTHERS = []
- for each in dir(__builtins__):
- if re.match('.*builtin_function_or_method', str(type(eval(each)))):
- FUNCTION.append(each)
- elif re.match("^<class '_.*", str(type(eval(each)))):
- OTHERS.append(each)
- else:
- CLASS.append(each)
- print('Total BIF: %d including FUNCTION %d, CLASS %d and others %d' % (len(FUNCTION)+len(CLASS)+len(OTHERS), len(FUNCTION), len(CLASS), len(OTHERS)))
- print('FUNCTION:')
- print(FUNCTION)
- print('CLASS:')
- print(CLASS)
- print('OTHERS:')
- print(OTHERS)
复制代码
Total BIF: 152 including FUNCTION 42, CLASS 103 and others 7
FUNCTION:
['__build_class__', '__import__', 'abs', 'all', 'any', 'ascii', 'bin', 'callable', 'chr', 'compile', 'delattr', 'dir', 'divmod', 'eval', 'exec', 'format', 'getattr', 'globals', 'hasattr', 'hash', 'hex', 'id', 'input', 'isinstance', 'issubclass', 'iter', 'len', 'locals', 'max', 'min', 'next', 'oct', 'open', 'ord', 'pow', 'print', 'repr', 'round', 'setattr', 'sorted', 'sum', 'vars']
CLASS:
['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', 'WindowsError', 'ZeroDivisionError', '__debug__', '__doc__', '__name__', '__package__', '__spec__', 'bool', 'bytearray', 'bytes', 'classmethod', 'complex', 'dict', 'enumerate', 'filter', 'float', 'frozenset', 'int', 'list', 'map', 'memoryview', 'object', 'property', 'range', 'reversed', 'set', 'slice', 'staticmethod', 'str', 'super', 'tuple', 'type', 'zip']
OTHERS:
['__loader__', 'copyright', 'credits', 'exit', 'help', 'license', 'quit'] |