1 v=dict.fromkeys(["k1",12356,"494949"],123) 2 {‘494949‘: 123, 12356: 123, ‘k1‘: 123} 3 4 v=dict.fromkeys(["k1",12356,"494949"],123) 5 v1=v.get("k0",1223)(另一种获得字典中值得方法) 6 dict 7 8 v=dict.fromkeys(["k1",12356,"494949"],123) 9 v1=v.setdefault("k0",100) 设置一个值,如果存在则取出已经存在的值,如果不存再添加进去 10 dict 11 12 v=dict.fromkeys(["k1",12,"494949"],123) 13 v.update({"k1":15,"k3":45}) 14 v.update(k1=15,k3=45)此种写法也是可以的 15 {‘k1‘: 15, 12: 123, ‘k3‘: 45, ‘494949‘: 123}