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

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

字符串 - str(string)

整数 - int(integer)

浮点数 - float

布尔型 - bool(boolean)

 

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

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

输出: str  |  int  |  float  |  bool

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

相关文章:

  • 2021-05-22
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2021-07-29
  • 2021-09-16
猜你喜欢
  • 2022-12-23
  • 2021-08-08
  • 2021-12-11
  • 2021-04-02
  • 2021-04-01
  • 2021-04-24
  • 2021-12-01
相关资源
相似解决方案