1. List
1. the list is compared to a string. data types are not restricted. and can store a lot of data.
2. representation: [] each item in square brackets is separated by commas
3. lists and strings, as well as indexes and slices
Common functions:
1. Add : Append () can only be added at the end of the list
2. Change : Remove()
3. Change : Index modification
4. Check : for Loop
Common methods:
1. Len () calculates the length of the string
2. count () find the number of "xxx" occurrences
3. sort () sorting
Index and slice cases for lists
Index:
Slice:
two. Columns table additions and deletions to change
Increase
Delete There ( pop, remove, clear, Del[delete] )
Pop the last string is deleted by default, You can also instruct the subscript to delete
Remove Specifies that deleted elements Delete elements that do not exist will cause an error
Clear Clear List ( List )
Slice Delete del [m:n] Remove a range from the list
del [M:N]
Change
Index, Slice modification
Check
Enquiry , column column table is ? an Iterative object , so you can go in ? for Loops
Three. counting, sorting
Count count ()
Sort: usually sort by numbers
sort () Ascending
sort (reverse = True) Descending
Reverse Sequential Rollover [:: -1]
List nesting:
The use of reduced-dimensional operation, one layer to see
Four . tuples and tuples nesting (tuple)
1. tuples : commonly known as immutable lists . read-only lists, indexed and sliced, which can be used for any data type, can be queried. Loops can also be. Slices can also. But just can't change.
2. Presentation: () each item in parentheses is separated by commas
Note:
immutable is its inner child element. if the child element is a list. The elements in the list can be changed.
Five. Range
Range can help us get to a set of data. This data can be obtained through a For loop
List (index and slice, additions and deletions), count, sort, ganso and ganso nesting