5 1 # 创建字典 6 2 d=dict(name='lily',age=18,phone='') 7 3 print(d) 4 # {'name': 'lily', 'age': 18, 'phone': '188011514000'} 5 6 # 通过key获取对应vlaue 7 name =d['name'] 8 print(name) 9 # lily 10 11 # in,not in 判断key是否存在 12 if 'name' in d: 13 print('name is ex…