python变量的数据类型

变量在赋值时会自动判断数据的类型

python最常用的有四种数据类型

字符串 - str(string)

整数 - int(integer)

浮点数 - float

布尔型 - bool(boolean)

type函数用于得到变量的数据类型

语法: 变量 = type(变量名)

输出: str  |  int  |  float  |  bool

print(type(变量名)) #函数套用

原文地址:https://www.cnblogs.com/enjie/p/11108424.html