字典构造:
a=dict(one=1,two=2,three=3) b={'one':1,'two':2.'three'=3} c=dict(zip(['one','two','three'],[1,2,3]))
字典推导:
dic=[(86,'China'),(91,'India'),(1,'United States')] countrycode={contry:code for code,contry in dic }
字典找不键的又要插入新值怎么处理
my_dict.setdefault(key,[]).append(new_value)
如果键不存在,把key和字典放在一个映射,并返回此时的列表。