创建字典 dict1 = {'k1': 'v1', 'k2': 'v2', 'k3': 'v3', 'k4': 'v4'} dict2 = dict(k1='v1', k2='v2', k3='v3', k4='v4') dict3 = dict([('k1', 'v1'), ('k2', 'v2'), ('k3', 'v3')]) 获取字典值 print(dict1['k1']) print(dict1.get('k1')) # 区别在于没有key不会报错 print(dict1.get('k…