What is the purpose of the typeof function in Python?

typeof is not a built-in function in Python, it is correct to use the type function to get the type of an object. The type function returns the type of an object. For example:

x = 5
print(type(x))  # <class 'int'>

y = "Hello"
print(type(y))  # <class 'str'>

z = [1, 2, 3]
print(type(z))  # <class 'list'>
Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds