Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python code to convert all keys of dict into lowercase

my_dict = {'KEY1': "Hello", 'Key2': "World"} 
new_dict = dict((k.lower(), v) for k, v in my_dict .items()) 
print(new_dict
Comment

convert dictionary keys/values to lowercase in python

def lower_dict(d):
   new_dict = dict((k.lower(), v.lower()) for k, v in d.items())
   return new_dict
a = {'Foo': "Hello", 'Bar': "World"}
print(lower_dict(a))
Comment

convert dictionary keys/values to lowercase in python

my_dict = {'KEY1': "Hello", 'Key2': "World"} 
new_dict = dict((k.upper(), v.upper()) for k, v in my_dict .items()) 
print(new_dict)
Comment

convert dictionary keys/values to lowercase in python

def lower_dict(d):
   new_dict = dict((k.lower(), v) for k, v in d.items())
   return new_dict
a = {'Foo': "Hello", 'Bar': "World"}
print(lower_dict(a))
Comment

convert dictionary keys/values to lowercase in python

my_dict = {'KEY1': "Hello", 'Key2': "World"} 
new_dict = dict((k, v.lower()) for k, v in my_dict .items()) 
print(new_dict)
Comment

PREVIOUS NEXT
Code Example
Python :: user agents list 
Python :: seaborn rotate xlabels 
Python :: how to plot count on column of dataframe 
Python :: pyspark distinct select 
Python :: how to get specific row in pandas 
Python :: make first row columns pandas 
Python :: random gen in python 
Python :: pandas concat and reset index 
Python :: how to take screenshots with selenium webdriver python 
Python :: torch save state dict 
Python :: python remove empty string from list 
Python :: python check if folder is empty 
Python :: pygame quit 
Python :: python print to file 
Python :: unimport library python 
Python :: python get image dimensions 
Python :: seaborn pairplot label rotation 
Python :: python selenium move cursor to element 
Python :: flask minimal install 
Python :: python color text on windows 
Python :: generate random string python 
Python :: how to open file in BeautifulSoup 
Python :: update anaconda 
Python :: python requests wait for page to load 
Python :: merge pdf in python 
Python :: how to get only first record in django 
Python :: how to install nltk 
Python :: python prompt for input 
Python :: dictionaries to http data python 
Python :: plt.clear 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =