Python: Remove a specified dictionary from a given list
48. Remove Specified Dictionary from a List
Write a Python program to remove a specified dictionary from a given list.
Visual Presentation:

Sample Solution:
Python Code:
Sample Output:
Original list of dictionary: [{'id': '#FF0000', 'color': 'Red'}, {'id': '#800000', 'color': 'Maroon'}, {'id': '#FFFF00', 'color': 'Yellow'}, {'id': '#808000', 'color': 'Olive'}] Remove id #FF0000 from the said list of dictionary: [{'id': '#800000', 'color': 'Maroon'}, {'id': '#FFFF00', 'color': 'Yellow'}, {'id': '#808000', 'color': 'Olive'}]
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program to filter out a dictionary from a list based on a matching key-value pair using list comprehension.
- Write a Python program to remove a dictionary with a specified key from a list of dictionaries by iterating over the list.
- Write a Python program to implement a function that deletes dictionaries from a list that match given criteria.
- Write a Python program to use filter() to exclude dictionaries that contain a specific key-value combination.
Go to:
Previous: Write a Python program to split a given dictionary of lists into list of dictionaries.
Next: Write a Python program to convert string values of a given dictionary, into integer/float datatypes.
Python Code Editor:
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.