タイトル: キーの存在チェック
SEOタイトル: Pythonの辞書(dict)におけるキーの存在チェック
|
dict1 = {'key1': 'val1', 'key2': 'val2'} if not 'key1' in dict1: # 存在しなかった場合の処理 |