def main():
dict1={'姓名':'张三', '工资': 5000}
dict2={'姓名':'李四', '工资': 6600}
dict3={'姓名':'王五', '工资': 8500}
dict4={}
dict1.update(dict2)#字典的写法
print(dict1)
dict1.setdefault("3月",0)#存在不作为,不存在则增补
print(dict1)
names=[]
list=[dict1,dict2,dict3]
for data in list:
if data['工资']>5000:
names.append(data['姓名'])
print(names)
if __name__ == '__main__':
main()
结果: