Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

swap keys and values in dictionary python

my_dict = {'x':1, 'y':2, 'z':3}
my_swapped_dict = {v: k for k, v in my_dict.items()}
#{1: 'x', 2: 'y', 3: 'z'}
Comment

PREVIOUS NEXT
Code Example
Python :: convert grayscale to rgb python 
Python :: how to check if an input is a number in python 
Python :: django gmail smtp 
Python :: check if number is power of 2 python 
Python :: check pip version 
Python :: python time a funciton 
Python :: remove None pandas 
Python :: display max rows pandas 
Python :: proxy selenium python 
Python :: age in days to age in years 
Python :: E tensorflow/stream_executor/cuda/cuda_dnn.cc:329] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR 
Python :: matplotlib plot remove margins 
Python :: Print Table Using While Loop In Python 
Python :: how to multiply inputs in python 
Python :: log scale seaborn 
Python :: how to return the derivative of a function in python 
Python :: imbade image to jupyter notebook 
Python :: fibonacci python 
Python :: decisiontreeclassifier sklearn 
Python :: pandas shift one column 
Python :: how to convert kg to g using python 
Python :: pygame render text 
Python :: convert dataframe column to float 
Python :: python pandas trim values in dataframe 
Python :: python create n*n matrix 
Python :: python generate rsa key pair 
Python :: remove title bar in tkinter 
Python :: import file to colab 
Python :: python date get day 
Python :: python detect tty 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =