内置函数¶
此处描述了所有内置函数和异常,这些函数和异常也可通过 builtins
模块获得。
函数和类型¶
-
abs
()¶
-
all
()¶
-
any
()¶
-
bin
()¶
-
class
bool
¶
-
class
bytearray
¶
-
class
bytes
¶
-
callable
()¶
-
chr
()¶
-
classmethod
()¶
-
compile
()¶
-
class
complex
¶
-
delattr
(obj, name)¶ 参数名称应为一个字符串,且此函数从 obj 给出的对象中删除指定的属性。
-
class
dict
¶
-
dir
()¶
-
divmod
()¶
-
enumerate
()¶
-
eval
()¶
-
exec
()¶
-
filter
()¶
-
class
float
¶
-
class
frozenset
¶
-
getattr
()¶
-
globals
()¶
-
hasattr
()¶
-
hash
()¶
-
hex
()¶
-
id
()¶
-
input
()¶
-
class
int
¶
-
isinstance
()¶
-
issubclass
()¶
-
iter
()¶
-
len
()¶
-
class
list
¶
-
locals
()¶
-
map
()¶
-
max
()¶
-
class
memoryview
¶
-
min
()¶
-
next
()¶
-
class
object
¶
-
oct
()¶
-
open
()¶
-
ord
()¶
-
pow
()¶
-
print
()¶
-
property
()¶
-
range
()¶
-
repr
()¶
-
reversed
()¶
-
round
()¶
-
class
set
¶
-
setattr
()¶
-
class
slice
¶ 内置 slice 为切片对象所具有的类型。
-
sorted
()¶
-
staticmethod
()¶
-
class
str
¶
-
sum
()¶
-
super
()¶
-
class
tuple
¶
-
type
()¶
-
zip
()¶
Exceptions¶
-
exception
AssertionError
¶
-
exception
AttributeError
¶
-
exception
Exception
¶
-
exception
ImportError
¶
-
exception
IndexError
¶
-
exception
KeyboardInterrupt
¶
-
exception
KeyError
¶
-
exception
MemoryError
¶
-
exception
NameError
¶
-
exception
NotImplementedError
¶
-
exception
OSError
¶ |见CPython文档|
OSError
.MicroPython并未实现errno
属性,而是使用标准方式来获取异常参数exc.args[0]
。
-
exception
RuntimeError
¶
-
exception
StopIteration
¶
-
exception
SyntaxError
¶
-
exception
SystemExit
¶
-
exception
TypeError
¶
-
exception
ValueError
¶
-
exception
ZeroDivisionError
¶