Given a dictionary like so:
my_map = {\'a\': 1, \'b\': 2}
How can one invert this map to get:
inv_map = {1: \'a\', 2: \'b\'
Another, more functional, way:
my_map = { 'a': 1, 'b':2 } dict(map(reversed, my_map.items()))