What is python data type?
Python basic data types are generally divided into six basic data types: number, string, list, tuple, dictionary and collection.

Among them, numbers include integers (including standard integers, long integers (Python2.7 and before)), floating-point types, complex types, Boolean types (Boolean types are integers with only two values) and these number types. Lists, tuples and strings are all sequences.

1, number

Numeric types are immutable objects. Changing the value of a variable is to generate/create a new object. Python supports multiple number types:

Integer (standard integer and long integer (Python2.7 and before)), Boolean, double precision floating point, decimal floating point, complex number.

2. Standard integer

Int, standard integer, the value range of standard integer is -2 3 1 to 231on most 32-bit machines, that is,-2147483648 ~ 214748366 on 64-bit machines.

3. Boolean type

Since Python2.3, Bool and Boolean types have been added to Python. There are two types of Boolean: True and False. For objects without a __nozero__ method, the default value is True.

For numbers with a value of 0, an empty set (empty list, empty tuple, empty dictionary, etc. ) Boolean types are all false in Python.

& gt& gt& gt? Boolean type (1)

real

& gt& gt& gt? Boolean type ('a')

real

& gt& gt& gt? Boolean type (0)

wrong

& gt& gt& gt? Boolean type ("")

wrong

4, floating-point type

Float, each floating-point type accounts for 8 bytes (64 bits), which fully conforms to the IEEE754 specification (52m/1 1 e/1s), in which 52 bits are used to represent the bottom, and1bit is used to represent the index (the representable range is about

Floating-point values usually have a decimal point and an optional suffix e (uppercase or lowercase, indicating scientific notation). Between e and exponent, the sign of exponent can be expressed by positive (+) or negative (-) (if it is positive, the sign can be omitted).

The above is the description of floating-point (double-precision floating-point) in Python core programming. The default length of floating-point types measured by Python is 24 bytes. If it exceeds this range, it will be automatic.

5. Complex number type

Complex numbers and imaginary numbers cannot exist in complex numbers alone. They always form a complex number with a real part value of 0.0. Complex numbers consist of real and imaginary parts. Imaginary number syntax: real number +imagj.

Both the real part and the imaginary part are floating-point types. The imaginary part must have the suffix j or J.