>>> if myDict.has_key(key): myDict.pop(key)
Another way
>>> {k:v for k, v in myDict.items() if k!='key'}
You can delete by conditions. No error if key doesn't exist
>>> if myDict.has_key(key): myDict.pop(key)
Another way
>>> {k:v for k, v in myDict.items() if k!='key'}
You can delete by conditions. No error if key doesn't exist