How could I do the below code with a list comprehension. I have been looking at these examples, but I can't figure it out :|
Python: Removing list element while iterating over list
list_dicts = [{'site': 'living', 'status': 'ready' }, {'site': 'keg',
'status': 'ready' }, {'site': 'box', 'status': 'ready' }, {'site': 'wine',
'status': 'not_ready' }]
def call_some_func(m_site_dict):
print "I executed the 'call_something_function'"
for site in list_dicts[:]:
if site['status'] == 'ready':
call_some_func(site)
list_dicts.remove(site)