A quick way to switch keys and values in a python dictionary

published Jun 12, 2014 01:55   by admin ( last modified Jun 12, 2014 01:55 )
{value:key for key, value in a_dictionary.items()}

 

Tested in python 2.7