DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
switching keys and values in a dictionary in python [duplicate]
my_dict = {2:3, 5:6, 8:9} new_dict = {} for k, v in my_dict.items(): new_dict[v] = k
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#switching
#keys
#values
#dictionary
#python
ADD COMMENT
Topic
COMMENT
Name
4+1 =
Submit