Python字典处理技巧从字典中取(不想由于搜索的键不存在而异常)解决方法:使用字典的get方法 (get方法只读取
Python字典处理技巧
从字典中取值(不想由于搜索的键不存在而异常)
解决方法:
使用字典的get方法 (get方法只读取字典的值而不会去修改字典)
inter=dict.fromkeys([x for x in a if x in b])
Python字典处理技巧
从字典中取值(不想由于搜索的键不存在而异常)
解决方法:
使用字典的get方法 (get方法只读取字典的值而不会去修改字典)
inter=dict.fromkeys([x for x in a if x in b])