Python Getting Data Types
Getting the Data Type
You can get the data type of any object by using the type()
function:
Here are all the built-in data types in Python:
Example
print(type("Hello"))
print(type(3))
print(type(3.14))
print(type(1j))
print(type(["apple", "banana", "cherry"]))
print(type(("apple", "banana",
"cherry")))
print(type(range(6)))
print(type({"name" : "John", "age" :
36}))
print(type({"apple", "banana", "cherry"}))
print(type(frozenset({"apple", "banana", "cherry"})))
print(type(True))
print(type(b"Hello"))
print(type(bytearray(5)))
print(type(memoryview(bytes(5))))
Try it Yourself »