1. Arithmetic operation:
2. Comparison operation:
3. Assignment Operation:
4. Logical Operation:
5. Member Arithmetic:
--------------------------------------------------------------------------------------------------------------- ----------------------------
1. Digital
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~92233720368547758072. Boolean valueTrue or False 1 or 03. String
"Hello World"
String Common functions:
- Remove whitespace
- Segmentation
- Length
- Index
- Slice
4. ListTo create a list:
Name_list = ['Alex'seven'Eric' list(['Alex''seven' ' Eric '])
Basic operation:
- Index
- Slice
- Additional
- Delete
- Length
- Slice
- Cycle
- Contains
5, GansoTo create a meta-ancestor:
tuple ((11, 22, 33, 44, 55))
Basic operation:
- Index
- Slice
- Cycle
- Length
- Contains
6. Dictionary (unordered)To create a dictionary:
person = {"name""mr.wu"'age': 18 dict({"name""mr.wu" 'age': 18})
Common operations:
- Index
- New
- Delete
- Key, value, key-value pairs
- Cycle
- Length
PS: Loops, range,continue and break
--------------------------------------------------------------------------------------------------------------- ----------------------------
1. For LoopThe user iterates through the contents of an object in order, Ps:break, continue
Li = [11,22,33,44] for in Li: Print item
2, EnumrateAdd an ordinal to an object that can be iterated
Li = [11,22,33] for in enumerate (Li, 1): print(k,v)
3. Range and XrangeSpecify a range to generate the specified number
Print range (1, ten)# results: [1, 2, 3, 4, 5, 6, 7, 8, 9]print range (1, ten, 2)
# results: [1, 3, 5, 7, 9]print range (, 0,-2)# results: [30, 28, 26, 24, 22, (+), 8, 6, 4, 2]
Python development "Third article": Basic data types