python变量的数据类型

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

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

字符串 - str(string)

整数 - int(integer)

浮点数 - float

布尔型 - bool(boolean)

 

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

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

输出: str  |  int  |  float  |  bool

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

posted @ 2019-06-30 00:46  enjie  阅读(245)  评论(0编辑  收藏  举报