数据类型就是变量值的类型,也就是可以为变量赋哪些值
1.数值: 整数:包括布尔值True和False(进行逻辑判断,True相当于1,False相当于0,是整数类型);
浮点数;
复数;
2.字符串;str
3.空值;None:空值,表示不存在;
检查值的类型用type()函数
print(type(2))
print(type(3.5))
print(type(True))
print(type('hello'))
print(type(None))
<class 'int'>
<class 'float'>
<class 'bool'>
<class 'str'>
<class 'NoneType'>