2.4 数据类型
一、数据类型
入门阶段直接出三种类型:
字符串:string
整数:int
浮点数:float
如何验证谁类型:
type(被查看的类型)注意:变量没有类型,变量的值有类型
二、案例:
print(type(111))
print(type(1.4))
print(type("1234"))注意:字符串输出的是
str,也就是string的缩写可以直接输出;也可以通过变量中转一下
Last updated
Was this helpful?
入门阶段直接出三种类型:
字符串:string
整数:int
浮点数:float
如何验证谁类型:type(被查看的类型)
注意:变量没有类型,变量的值有类型
print(type(111))
print(type(1.4))
print(type("1234"))注意:字符串输出的是
str,也就是string的缩写可以直接输出;也可以通过变量中转一下
Last updated
Was this helpful?
Was this helpful?