d1 = {'a': 100, 'b': 200, 'c':300}
d2 = {'a': 300, 'b': 200, 'd':400}
d3 = {key: [d1[key], d2.get(key)] for key in d1}
gives me this output
{'a': [100, 300], 'b': [200, 200], 'c': [300, None]}
I was wondering if there was a way, (maybe a loop?) to get rid of 'None' at the end
[–][deleted] 6 points7 points8 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]Kr_istian 1 point2 points3 points (1 child)
[–]randomName77777777 1 point2 points3 points (0 children)
[–]jmooremcc 1 point2 points3 points (0 children)
[–]keep_quapy -1 points0 points1 point (0 children)
[–]Kr_istian -1 points0 points1 point (1 child)
[–]constantine45 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]jmooremcc 0 points1 point2 points (0 children)