#encoding =utf-8
print ' China '
#字典的一键多值
print ' Scheme A list is allowed to repeat as a value of Dict '
d1={}
Key=1
value=2
D1.setdefault (key,[]). Append (value)
value=2
D1.setdefault (key,[]). Append (value)
Print D1
#获取值
print ' Scheme one get value '
Print List (D1[key])
print ' scheme deletes a value, leaving an empty list '
D1[key].remove (value)
D1[key].remove (value)
Print D1
print ' Scenario One checks if there is a value '
Print D1.get (key,[])
print ' scenario two using a sub-dictionary as a value value for Dict does not allow duplicates '
d1={}
Key=1
keyin=2
value=11
D1.setdefault (key,{}) [Keyin]=value
keyin=2
Value=22
D1.setdefault (key,{}) [Keyin]=value
Keyin=3
Value=33
D1.setdefault (key,{}) [Keyin]=value
Print D1
print ' Scenario two get value '
Print List (D1[key])
print ' Scenario Two delete value, leaving an empty list '
Del D1[key][keyin]
keyin=2
Del D1[key][keyin]
Print D1
print ' Scenario Two check if there is a value '
Print D1.get (key, ())
print ' scenario three using Set as Dict value value does not allow duplicates '
d1={}
Key=1
value=2
D1.setdefault (Key,set ()). Add (Value)
value=2
D1.setdefault (Key,set ()). Add (Value)
Value=3
D1.setdefault (Key,set ()). Add (Value)
Print D1
print ' Scheme three get value '
Print List (D1[key])
print ' Scenario Three delete value, leaving an empty list '
D1[key].remove (value)
value=2
D1[key].remove (value)
Print D1
print ' Scheme Three check if there is a value '
Print D1.get (key, ())
Python dictionary multiple