Is there any other way to delete an item in a dictionary only if the given key exists, other than:
if key in mydict:
del mydict[key]
The scenario is that I’m given a collection of keys to be removed from a given dictionary, but I am not certain if all of them exist in the dictionary. Just in case I miss a more efficient solution.