Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to replace single string in all dictionary keys in python

sample_dictionary={'Ballaji 05': 'QA', 'Priya 06': 'QA tech'}
sample_dictionary={key.replace(" ",""):value
                   for key,value in sample_dictionary.items()
                   }
print(sample_dictionary)
>>{'Ballaji05': 'QA', 'Priya06': 'QA tech'}
Comment

PREVIOUS NEXT
Code Example
Python :: convert array to dataframe python 
Python :: You did not provide the "FLASK_APP" environment variable 
Python :: how to find how many processors you have with python 
Python :: simulated annealing python 
Python :: python get everything between two characters 
Python :: how to sort list in descending order in python 
Python :: next day in python without using datetime 
Python :: python pandas cumulative sum of column 
Python :: pandas to tensor torch 
Python :: comparing file content in python 
Python :: python temporary files 
Python :: print all alphabets from a to z in python 
Python :: get information about dataframe 
Python :: b1-motion tkinter 
Python :: python ls 
Python :: python read mp3 livestream 
Python :: command prompt pause in python 
Python :: pyspark correlation 
Python :: Finding the Variance and Standard Deviation of a list of numbers in Python 
Python :: print a random word from list python 
Python :: sklearn rmse 
Python :: python title case 
Python :: python file name from absolute path 
Python :: how to convert input to uppercase in python 
Python :: How to perform insertion sort, in Python? 
Python :: timed loop python 
Python :: python virus 
Python :: python find word in list 
Python :: python numpy arrays equality 
Python :: explode dictionary pandas 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =