Use a dictionary in Python in the following format:
dict={key1:value1, Key2;value2 ...}
The following format is used when the dictionary value is actually accessed:
Multi-key value
The multiple-key form of a dictionary is as follows:
dict={(KE11,KEY12): Value, (KEY21,KEY22): Value ...}
The actual access to the values in the dictionary is shown as follows (take the first key as an example):
Or is:
Here is the actual example:
Multi-valued
When a key value corresponds to multiple values, the format:
Dict={key1: (Value1,value2 ...), Key2: (Value1,value2 ...) ...}
The format for accessing the values in the dictionary is as follows:
Or
Circular Assignment (emphasis)
The syntax structure is as shown in the following example
Summarize:
By using the instructions above, you know that in the definition of a dictionary, the colon (:) number is a whole before and after, even if you use parentheses () to include the part before and after the colon, when accessing the dictionary value, it is best to place the key in parentheses as a whole.
Multiple key value pairs with the same key value
In the dictionary, a key with at least two members is the same, but the key corresponds to a different value, in the following format:
dict={key1:value1
key1:vaklue2,
...}
The value that is assigned to the key later in this formal form becomes the true value of the key.
Use lists, dictionaries as values for dictionaries
Format
dict={Key1: (key11:value,key12:value),
Key2: (key21:value,key22:value)
}
Access dictionary is worth the formatting (take the first key as an example):
The actual example looks like this:
The above is a small series for everyone to bring the Python dictionary multiple key values and duplicate key value of the use of the method (detailed), I hope that we support cloud Habitat Community ~