Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert keys to values in python

old_dict = {'A': 67, 'B': 23, 'C': 45, 'D': 56, 'E': 12, 'F': 69, 'G': 67, 'H': 23} 
  
new_dict = dict([(value, key) for key, value in old_dict.items()])
print(new_dict)
for i in new_dict: 
    print(i, " :  ", new_dict[i])
Comment

PREVIOUS NEXT
Code Example
Python :: python read html table 
Python :: webbrowser.google.open python 
Python :: read live video from usb opencv python 
Python :: pyqt loading screen 
Python :: Learn python 3 the hard way by by Zed Shaw 
Python :: delete specific indeces from numpy array 
Python :: export pythonpath linux 
Python :: How to install XGBoost package in python using conda 
Python :: Concat and Append DFs Python 
Python :: how to get location using python 
Python :: how to take unknown number of inputs in python 
Python :: map object to array python 
Python :: rename column pandas 
Python :: df empty 
Python :: pytest run only failed test 
Python :: find how many of each columns value pd 
Python :: how to run python file from cmd in dockerfile 
Python :: how to use with open 
Python :: uniform distribution python example 
Python :: split list in half python 
Python :: python print version 
Python :: selenium get parent element python 
Python :: how to plot corilation python 
Python :: assigning values in python 
Python :: python regex search group 
Python :: generate a random number in python between 0 and 1 
Python :: sum of number digits python 
Python :: datediff in seconds in pandas 
Python :: python program to count even and odd numbers in a list 
Python :: pygame caption 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =