remove key and his value from dictionary python code example
Example 1: delete a key value pair from a dictionary in python
mydict = {'score1': 41, 'score2': 23, 'score3': 45}
del mydict['score2']
print(mydict)
{'score1': 41, 'score3': 45}
Example 2: python remove key from dict
my_dict.pop('key', None)