Function Name:
del()
Function Type:
Works like a built-in function as the dict class implements the __del__() method.
Parameters:
dict_key_in – The key for which the key-value pair to be deleted in the python dictionary.
Return Type:
None
Exception Handling:
If the dict_key_in is not found in the python dictionary a KeyError exception will be raised.
Example:
# Example Python program that deletes a key-value # Create a dictionary # Delete an extinct bird # Delete another extinct bird print("Entries of the dictionary after del() calls:");
|
Output:
Entries of the dictionary after del() calls: |