python 判断数据类型
Python 中可以使用 type() 函数来判断数据类型。
例如:
x = 5
print(type(x)) # <class 'int'>
y = 3.14
print(type(y)) # <class 'float'>
z = "Hello, World!"
print(type(z)) # <class 'str'>
输出结果分别为 int、float 和 str,表示 x 是整型,y 是浮点型,z 是字符串类型。
原文地址: https://www.cveoy.top/t/topic/hsVh 著作权归作者所有。请勿转载和采集!