python typeof函数的作用是什么
typeof
不是Python内置函数,正确的是使用type
函数来获取对象的类型。type
函数的作用是返回一个对象的类型。例如:
x = 5
print(type(x)) # <class 'int'>
y = "Hello"
print(type(y)) # <class 'str'>
z = [1, 2, 3]
print(type(z)) # <class 'list'>
阅读剩余
THE END
typeof
不是Python内置函数,正确的是使用type
函数来获取对象的类型。type
函数的作用是返回一个对象的类型。例如:
x = 5
print(type(x)) # <class 'int'>
y = "Hello"
print(type(y)) # <class 'str'>
z = [1, 2, 3]
print(type(z)) # <class 'list'>