方法二:使用dict.get()方法如果给定键存在且未找到所请求的键,该dict.get( )方法将返回与给定键关联的值。Nonemy_dict = {''key1'': ''value1'', ''key2'': ''value2'', ''key3'': ''value3''}if my_dict.get(''key1'') is not None: print("Key exists in the dictionary.")else: ...