Resources:
1. Basic Python Tutorial
2. http://www.runoob.com/python/python-lists.html
3. http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000
Built-in functions for common operations lists:
| Serial Number |
function |
| 1 |
CMP (List1, List2) Compare two elements of a list |
| 2 |
Len (list) Number of list elements |
| 3 |
Max (list) Returns the maximum value of a list element |
| 4 |
MIN (list) Returns the minimum value of a list element |
| 5 |
List (seq) Convert a tuple to a list |
Common list methods:
| Serial Number |
Method |
| 1 |
List.append (obj) Add a new object at the end of the list |
| 2 |
List.count (obj) Count the number of occurrences of an element in a list |
| 3 |
List.extend (seq) Append multiple values from another sequence at the end of the list (extend the original list with a new list) |
| 4 |
List.index (obj) Find the index position of the first occurrence of a value from the list |
| 5 |
List.insert (index, obj) Inserting an object into a list |
| 6 |
List.pop (Obj=list[-1]) Removes an element from the list (the last element by default), and returns the value of the element |
| 7 |
List.remove (obj) To remove the first occurrence of a value in a list |
| 8 |
List.reverse () Reverse List of elements |
| 9 |
List.sort ([func]) Sort the original list |
Python Basic Learning Notes (vi) common list manipulation functions and methods