如何查看所有内置的python模块和库?

时间:2018-03-02 10:27:54

标签: python windows ubuntu

作为程序员,了解我们想要学习的编程语言中的内置类型是很重要的。因此,作为python编程语言的初学者,我非常有兴趣知道python的内置模块和库是python2还是python3。所以我请求任何人给我一个可能的方法。

1 个答案:

答案 0 :(得分:0)

您可以在Python Standard Library查看Python内置函数,或在交互式解释器中列出它们:

>>> for builtin in dir(__builtins__):
...     print builtin
...
ArithmeticError
AssertionError
AttributeError
BaseException
BufferError
BytesWarning
DeprecationWarning
EOFError
Ellipsis
EnvironmentError
Exception
False
FloatingPointError
FutureWarning
GeneratorExit
IOError
ImportError
ImportWarning
IndentationError
IndexError
KeyError
KeyboardInterrupt
LookupError
MemoryError
NameError
None
NotImplemented
NotImplementedError
OSError
OverflowError
PendingDeprecationWarning
ReferenceError
RuntimeError
RuntimeWarning
StandardError
StopIteration
SyntaxError
SyntaxWarning
SystemError
SystemExit
TabError
True
TypeError
UnboundLocalError
UnicodeDecodeError
UnicodeEncodeError
UnicodeError
UnicodeTranslateError
UnicodeWarning
UserWarning
ValueError
Warning
ZeroDivisionError
_
__debug__
__doc__
__import__
__name__
__package__
abs
all
any
apply
basestring
bin
bool
buffer
bytearray
bytes
callable
chr
classmethod
cmp
coerce
compile
complex
copyright
credits
delattr
dict
dir
divmod
enumerate
eval
execfile
exit
file
filter
float
format
frozenset
getattr
globals
hasattr
hash
help
hex
id
input
int
intern
isinstance
issubclass
iter
len
license
list
locals
long
map
max
memoryview
min
next
object
oct
open
ord
pow
print
property
quit
range
raw_input
reduce
reload
repr
reversed
round
set
setattr
slice
sorted
staticmethod
str
sum
super
tuple
type
unichr
unicode
vars
xrange
zip