dict.get('key')和dict['key']的区别时间:2023-03-09 06:22:25 dict['key']只能获取存在的值,如果不存在会触发KeyError dict.get('key', default=None)如果不存在,返回一个默认值