对象的三个特征
身份、类型 和 值
id()
type()
>>> string = 'hello world'
>>> id(string)
4388768264
>>> type(string)
<class 'str'>
常见的内置类型
- None (全局只有一个): 在 Python 解释器中存在且只存在唯一的一个 None 对象
>>> a = None
>>> b = None
>>> id(a) == id(b)
True
数值类型:
int
float
complex
bool迭代类型
序列类型
list
bytes bytearray memeoryview (二进制序列)
range
tuple
str
array映射类型
dict集合
set
frozenset上下文管理类型
with statement其他
模块类型
类和实例
函数类型
方法类型
代码类型
object 对象
type 类型
ellipsis 类型
notimnotimpleted