值我有2個字典在Python在一個字典替換鍵與鍵從另一個詞典在Python
dict1={'_Switch1': {'portB': '20', 'portA': '10'}, '_Switch2': {'portB': '200', 'portA': '100'}}
dict2={'_Switch1': {'portB': 'eth1/2', 'portA': 'eth1/1'}, '_Switch2': {'portB': 'eth2/2', 'portA': 'eth2/1'}}
我找AA簡單的方法,我怎麼能映射dict2鍵的值到dict1。
產生的字典應該是這個樣子
dict3={'_Switch1': {'eth1/2': '20', 'eth1/1: '10'}, '_Switch2': {'eth2/2': '200', 'eth2/1': '100'}}