Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Python supported data types
Python supported data types
Number of data types supported by python ($ NUMBER)

Python numeric data types are used to store numeric values and support three different numeric types:

1, integer (int)

Also known as integer, there is no decimal point, and the integer size in Python3 is not limited, so it can be used as a long type, so there is no long type in Python3.

2. Floating type

It consists of an integer part and a decimal part, such as: 3. 14 15, -5.8, which can also be expressed by scientific counting method, such as: 3.5e3, which is equal to: 3.5e3 = 3.5× 10 3 = 3500.

3. Complex number

Complex number consists of real part and imaginary part, which can be expressed by a+bj or complex number (a, b). Both the real part A and imaginary part B of complex numbers are floating-point types, such as 6.5+32j and strings.

String can be said to be the most commonly used data type in Python, and it is a string composed of special symbols such as numbers, letters and underscores, such as' hello world!' This is what we are most familiar with. It's just a string.

Python six data types, come and find out.

Tabulation/listing

The list uses a pair of "[]" to enclose single or multiple elements, such as ['Baidu',' Hello', 123,' ACDE'], and each element is separated by commas.

Python six data types, come and find out.

tuple

A tuple encloses one or more elements with a pair of "()" and each element is separated by a comma. In addition, after a tuple is created, the elements cannot be modified, which is very different from a list.

Python six data types, come and find out.

dictionary

Each key-value pair (key => value) of the dictionary is separated by a colon (:), and each pair is separated by a comma (,). The whole dictionary is enclosed in curly braces. The format is as follows:

d ={key 1 : value 1,key2 : value2 }

The dictionary is out of order, that is, if you want to get a value, you must get 3.5e3-3. 1j through its keys.