dir(__builtins__)
想请教一下大家关于查看python内置函数的问题,我用的是spyder。1、在编辑器输入dir(__builtins__)运行,控制台只显示runfile,并没有函数列表
2、在控制台输入dir(__builtins__)回车,只出现了41个函数,并没有小甲鱼视频里的那么多。
1,你用 print 打印了吗?
2,我这里没有这个问题? qiuyouzhi 发表于 2021-1-24 15:31
1,你用 print 打印了吗?
2,我这里没有这个问题?
1、用了print成功解决
2、我的是python 3.8,可能是版本问题函数没那么多
非常感谢! Nakupenda_wewe 发表于 2021-1-24 15:51
1、用了print成功解决
2、我的是python 3.8,可能是版本问题函数没那么多
如果问题已解决,请设置【最佳答案】
顺便说下,我的Python版本是3.8.1,有153个内置函数
你把你打印出来的列表发我看看呗? qiuyouzhi 发表于 2021-1-24 15:58
如果问题已解决,请设置【最佳答案】
顺便说下,我的Python版本是3.8.1,有153个内置函数
你把你打印 ...
['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values'] Nakupenda_wewe 发表于 2021-1-24 16:17
['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__for ...
额
你这个运行的是dir(dict)吧
里面的东西都是字典的方法 qiuyouzhi 发表于 2021-1-24 16:35
额
你这个运行的是dir(dict)吧
里面的东西都是字典的方法
我试了一下,输入dir(__builtins__)和输入dir(dict)结果是一样的{:10_257:} Nakupenda_wewe 发表于 2021-1-24 16:43
我试了一下,输入dir(__builtins__)和输入dir(dict)结果是一样的
重启一下IDLE? qiuyouzhi 发表于 2021-1-24 16:52
重启一下IDLE?
重启之后再运行成功了,有159个,谢谢{:5_106:}
['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','__IPYTHON__','__build_class__','__debug__','__doc__','__import__','__loader__','__name__','__package__','__spec__','abs','all','any','ascii','bin','bool','breakpoint','bytearray','bytes','callable','cell_count','chr','classmethod','compile','complex','copyright','credits','debugcell','debugfile','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','runcell','runfile','set','setattr','slice','sorted','staticmethod','str','sum','super','tuple','type','vars','zip']
页:
[1]