Dict Full name is dictionary, similar to map, use key value to store, fast
Initialize the Dict object with {"Key": value}, for example: d={"name": "Taoshihan"}
Data is stored via key, for example: d["Age"]=100
Use the IN keyword to determine if key exists, for example: res= "Age" in D,res is true
Use the Get () method of the Dict object to get the data, parameters: Key
For example: Age=d.get ("Age"), the age is 100
Characteristics:
Find and insert very fast and do not slow as key increases
Need to consume a lot of memory
Key must be an immutable object
The algorithm for calculating the position of value according to key is called the hash Algorithm (hash)
List is a mutable object cannot be an immutable object as KEY,STR can be a key
Set
Create a set, using the Set () method, Parameters: List object, repeating element is automatically filtered in set
Example: Myset=set ([+])
Add and remove elements using the Add (key) and remove (key) methods of the Set object
The only difference between set and dict is that it does not store the corresponding value
Tuple
There is a sequence table tuple, once initialized cannot be modified, if its element is a list, then the element list can be changed
Use () parentheses to initialize a tuple, parameter: element, Element
Example: mytuple= ("Zhangsan", "Lisi")
Define tuple with only one element, use (), parameter: element, avoid ambiguity add a comma
[Python] using dict and set