I have a problem with multiple conditions with list:
listionary = [{u'city': u'paris', u'id': u'1', u'name': u'paul'},
{u'city': u'madrid', u'id': u'2', u'name': u'paul'},
{u'city': u'berlin', u'id': u'3', u'name': u'tom'},
{u'city': u'madrid', u'id': u'4', u'name': u'tom'}]
I try to delete items that meet both conditions simultaneously.
[elem for elem in listionary if (elem.get('name')!='paul' and elem.get('city')!='madrid')]
In this case element is removed if meet at least one condition, I try to do it in several ways, any ideas?
Expected output:
[{u'city': u'paris', u'id': u'1', u'name': u'paul'}
{u'city': u'berlin', u'id': u'3', u'name': u'tom'}
{u'city': u'madrid', u'id': u'4', u'name': u'tom'}]
I would like to remove element which meet both conditions.