In Python, I need a dictionary object which looks like:
{\'a\': 10, \'b\': 20, \'c\': 10, \'d\': 10, \'e\': 20}
I\'ve been able to get th
There is one way that comes to mind. Still has the limitation of only having the same contents.
The value of one key can't change another.
key_map = {
'KEY_UP':move_up,
'w':'KEY_UP',
}
for key in key_map:
# loop over the `dict`
if key_map[key] in key_map:
# one key is the value of the other
target_key = key_map[key]
key_map[key] = key_map[target_key]
# overwrite key white the ontents of the other