使ってPython 3先頭に追加辞書(パイソン)
は、だから私は2つの辞書
すなわち
[{'code': '123456', 'reward': 'awesome reward', 'source': 'awesome source'},
{'code': '12345', 'reward': 'some reward', 'source': 'some source'}
]
と将来の目的のために
[ {'code': '123456', 'reward': 'awesome reward', 'source': 'awesome source'}
{'code': '12345', 'reward': 'some reward', 'source': 'some source'},
{'code': '54321', 'reward': 'another reward', 'source': 'another source'}
]
を持っている私はで最後のオブジェクトをしたいです2番目の辞書は「新しい」オブジェクトです
は、私はここにスーリヤの提案を使用して2つの辞書をマージすることができています
[ {'code': '54321', 'reward': 'another reward', 'source': 'another source'},
{'code': '123456', 'reward': 'awesome reward', 'source': 'awesome source'}
{'code': '12345', 'reward': 'some reward', 'source': 'some source'}
]
ことを一番上に最新のエントリ(辞書2の最後の1)と第三(または新規)辞書を作成したい:Combine two dictionaries and remove duplicates in python
これは私の新しい価値を追加します。私はいくつかの並べ替え機能を探しています。
私は明確でない場合は謝罪します。
ありがとうございます!
あなたは2本の*リスト*持っている、*辞書を含む各*。 –