def deleteVal (my_dict, key_val, val):
if len(my_dict.get(key_val, "1"))>1:
try:
my_dict[key_val].remove(val)
except ValueError:
pass
else:
my_dict.pop(key_val, None)
9
solved Removing a dictionary key value having multiple value [closed]