KOTA ITO

Generation

generate functionWed, 14 Dec 2022

ネストされた辞書型のデータから任意の値を取り出す

def get(data_structure, keys): for key in keys: data_structure = data_structure[key] return data_structure get({'a': {'b': 'c'}}, ['a', 'b']) # 'c' を返します

Questions about programming?Chat with your personal AI assistant