python 基础 | 0数据类型
Python标准数据类型:Numbers数字,String字符串,List列表,Tuple元组,Dict字典,set 集合
数字
字符串
布尔型
下面的数据类型先了解,之后会讲到的
list – 列表
c = [10, 20, 30]
print(type©)
tuple – 元组
d = (10, 20, 30)
print(type(d))
set – 集合
e = {10, 20, 30}
print(type(e))
dict – 字典 – 键值对
f = {‘name’: ‘TOM’, ‘age’: 18}
print(type(f))
数据类型的转换
注意:int(x)函数:将x转为整数,并不是四舍五入,直接取整。