Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Python :: procfile heroku python example 
Python :: how to find outliers in python 
Python :: CSRF verification failed. Request aborted. 
Python :: logistic regression algorithm in python 
Python :: replace all nan values in dataframe 
Python :: separate path python 
Python :: python copy variable 
Python :: drop a row with a specific value of a column 
Python :: sklearn cross_val_score scoring metric 
Python :: pi python 
Python :: python socket check if still connected 
Python :: python convert a string to a list of words 
Python :: int to string python 
Python :: get time format python2 hours minutes seconds milliseconds 
Python :: add time to a datetime object 
Python :: remove duplicates function python 
Python :: remove character from string by index in python 
Python :: pandas read dictionary 
Python :: python check string not exist in array 
Python :: where is tensorflow slim 
Python :: python mahalanobis distance 
Python :: how to check if text is in upper case in python 
Python :: run multiple function with multiprocessing python 
Python :: python tkinter getting labels 
Python :: duplicate data in python 
Python :: how to close opencv window in python 
Python :: input and ouput array in python 
Python :: python name input 
Python :: how to know the length of a dataset tensorflow 
Python :: numpy euclidean distance 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =