1. Digital
2 is an example of an integer.
Long integers are just larger integers.
3.23 and 52.3E-4 are examples of floating-point numbers. The e tag represents a power of 10. Here, 52.3E-4 means 52.3 * 10-4.
( -5+4j) and (2.3-4.6j) are examples of complex numbers, where -5,4 is a real number, j is an imaginary number, and what is the plural in mathematics?
int (integral type)
On a 32-bit machine, the number of integers is 32 bits and the value range is -2**31~2**31-1, which is -2147483648~2147483647
On a 64-bit system, the number of integers is 64 bits and the value range is -2**63~2**63-1, which is -9223372036854775808~9223372036854775807long (Long integer)
Unlike the C language, Python's long integers do not refer to the positioning width, that is, Python does not limit the size of long integer values, but in fact, because of limited machine memory, we use a long integer value can not be infinite.
Note that, since Python2.2, Python automatically converts integer data to long integers if an integer overflows, so it does not cause any serious consequences if you do not add the letter L after long integer data.
Float (float type)
A floating-point number is used to process real numbers, which are numbers with decimals. Similar to the double type in C, accounting for 8 bytes (64 bits), where 52 bits represent the bottom, 11 bits represent the exponent, and the remaining one represents the symbol.
Complex (plural)
The complex number consists of real and imaginary parts, the general form is X+yj, where x is the real part of the complex, and Y is the imaginary part of the complex, where x and y are real numbers. Note: Small number pools exist in Python:-5 ~ 257 2, Boolean true or False 1 or 03, string
"Hello World"
string concatenation of all evils: the string in Python is embodied in the C language as a character array, each time you create a string, you need to open a contiguous space in memory, and once you need to modify the string, you need to open up again, the evil + sign every occurrence will re-open a space within.
String Formatted output
| 1234 |
name ="alex"print "i am %s " % name #输出: i am alex |
PS: string is%s; integer%d; floating-point number%f
String Common functions:
- Remove whitespace
- Segmentation
- Length
- Index
- Slice
4. List Creation list:
| 123 |
name_list =[‘alex‘, ‘seven‘, ‘eric‘]或name_list = list([‘alex‘, ‘seven‘, ‘eric‘]) |
Basic operation:
- Index
- Slice
- Additional
- Delete
- Length
- Slice
- Cycle
- Contains
5, tuples (immutable list) Create tuples:
| 123 |
ages =(11, 22, 33, 44, 55)或ages =tuple((11, 22, 33, 44, 55)) |
6. Dictionaries (unordered) Create dictionaries:
| 123 |
person = < Code class= "Python plain" >{ : "Mr.wu" , ' age ' : 18 or person = dict "Mr.wu" , : 18 |
Common operations:
- Index
- New
- Delete
- Key, value, key-value pairs
- Cycle
- Length
Python basic syntax-data type