for example: a = {1:'hello' , 2:'bye'}
suppose I want to delete the element 2:'bye' through its value 'bye' , so can anyone help me by giving a piece of code.
thank you
for example: a = {1:'hello' , 2:'bye'}
suppose I want to delete the element 2:'bye' through its value 'bye' , so can anyone help me by giving a piece of code.
thank you
for what I know you can do it like this
for i in a: # the dictionary
if a[i] == 'bye':
del a[i]
Hopefully this helps