In programming, data type is an important concept.
Variables can store different types of data, and different types can perform different operations.
In these categories, Python has the following built-in data types by default:
You can use the type() function Get the data type of any object:
Instance
Print the data type of variable x:
x = 10 print(type(x))
Run the instance
In Python, when you assign a value to a variable, the data type is set:
If you wish to specify the data type, you can use the following constructor:
The above is the detailed content of How to get Python data type. For more information, please follow other related articles on the PHP Chinese website!