Skip to content
Advertisement

Pop or Delete a Dictionary item from list

I have this list of dictionary items. I want to delete a specific dictionary entry from the list by comparing it with a dictionary item

JavaScript

I have a variable

JavaScript

I would like to do,

JavaScript

To get,

JavaScript

Advertisement

Answer

It seems that you are trying to delete a tuple of items. Your to_delete is actually a tuple of dictionaries, so to delete them, simply unpack them into separate variables like:

JavaScript

Alternatively, you can keep one variable and accomplish the same by:

JavaScript

Remove method in Python

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement