我们假设我有两个词典:
dic1 = { "first":1, "second":4, "third":8}
dic2 = { "first":9, "second":5, "fourth":3}
Run Code Online (Sandbox Code Playgroud)
有没有直接的方法来获得如下所示的东西?
dic3 = { "first":[1,9], "second":[4,5], "third":[8], "fourth":[3]}
Run Code Online (Sandbox Code Playgroud)
我使用列表存储值,但元组也很好.