Function Name:
del()
Parameters:
dict_key_in – The key for which the key-value pair to be deleted in the python dictionary.
Return Type:
None
Overview:
- For the given key dict_key_in, the key-value pair is removed from the Python dictionary object.
- When dict_key_in is not found in the dictionary object a KeyError exception is 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: |