1. List
1-1. What is a list
- List code format: teacher = [ 'John Doe', 'John Doe', 'Wang Wu']
- Where [ 'John Doe', 'John Doe', 'Wang Wu'] is a list, a list of needed brackets [] to which various data framed, each of which is called a data "element." Should be separated by a comma between each element
1-2. Acquires a single item from the list
1-3. Extract a plurality of elements from the list
Formulas: about empty, take the head, take the left and right do not take.
1-4. List to add / remove elements
1-4-1. Add elements
1-4-2. Removing elements
2. Data Type: Dictionary
2-1. What is the dictionary (similar to java's Map, key, value value)
- Manifestation dictionary as: teacher1 = {1: 'John Doe', 2: 'John Doe', 3: 'Wang Wu', 4: 'Zhao six'}
- There are three dictionaries and lists the same place: 1. the name; use = 2 assignment; 3 comma as a delimiter between elements...
- List for the outer layer is in the brackets [], the dictionary is the outer braces {}
2-2. Dictionary add or delete elements
2-2-1. Add elements
Format: Dictionary [ 'key'] = value
2-2-2. Removing elements
Format: del dictionary [ 'keys']
2-2-3,
to modify elements dictionary
Format: Dictionary [ 'key'] = value
Extended: