I have been trying to delete multiple dictionaries in a list but I can only delete one at a time.
Below is the main code I am working on. Records is the list of dictionaries. I want to delete dictionaries that have 0 in them.
Records = [{'Name':'Kelvin','Price': 0},{'Name': 'Michael','Price':10}]
I want to delete dictionaries with Prices of 0
def deleteUnsold(self):
for d in records:
for key, value in d.items():
if d['Price'] == 0:
records.remove(d)