python3中到底有几类数据类型?

python3中貌似只有6种数据类型(字符串,数字,列表,字典,元组,集合),但是最近学到了类这章,1由类实例化产生的一个“实例”是否也算是一类数据类型?
2二元数组和布尔值 这两个东西是否也算是数据类型?

谢谢!

阅读 3.2k
3 个回答

Python3 中有六个标准的数据类型:

Number(数字)
String(字符串)
List(列表)
Tuple(元组)
Sets(集合)
Dictionary(字典)

Python3 的六个标准数据类型中:

不可变数据(四个):Number(数字)、String(字符串)、Tuple(元组)、Sets(集合);
可变数据(两个):List(列表)、Dictionary(字典)。 

除此之外你还可能看到bool类型,complex类型。

除此之外python3还有一个特有的bytes类型

官方文档里写的很详细
python 内建类型

这里简要列个目录:
4.4 Numeric Types — int, float, complex
4.5 Iterator Types
4.6 Sequence Types — list, tuple, range
4.7 Text Sequence Type — str
4.8 Binary Sequence Types — bytes, bytearray, memoryview
4.9 Set Types — set, frozenset
4.10 Mapping Types — dict
4.11 Context Manager Types
4.12 Other Built-in Types

回到问题本身,你列的是常用的6种,关于类、实例、布尔值则在4.12中。

推荐问题