This Section
- Lists, tuples operation
- String Manipulation
- Dictionary operations
- Set operations
- File Operations
- Character encoding and transcoding
1. list of tuples operation
After the list is one of our most common data types, the data can be achieved most convenient store, modify and other operations by list
Definition list
1
|
names
=
[
'Alex'
,
"Tenglan"
,
'Eric'
]
|
By indexed access elements in the list, index counts from 0
1
2
3
4
5
6
7
8
|
>>> names[
0
]
'Alex'
>>> names[
2
]
'Eric'
>>> names[
-
1
]
'Eric'
>>> names[
-
2
]
#还可以倒着取
'Tenglan'
|
Slice: taking a plurality of elements