Newbie question in dictionaries.
I'm trying to replace keys with values without using iteritems
like I've seen in some answers here.
I have 2 dictionaries. One with stuff in it and an empty one. I'd like to keep the first one as is, but print out the second one with the the keys and values replaced from the first one.
So for example:
d1 = {1:"hello", 2 : 10, 3 : 100.0}
The print of d2 will be "hello":1, 10:2, 100.0:3
This is my try:
d1 = {1:"hello", 2 : 10, 3 : 100.0}
d2 = {}
for k in d1:
d2[d1[k]] == d2[k]
print(d2)
I'm not quite sure where I'm wrong.