[email protected] wrote:
... If you have duplicates this will not work. You will have to do something like this instead:o=[] i=0 ln=len(l) while i<ln:if l[i]['title']=='ti': o.append(l.pop(i)) ln-=1 else: i+=1
Or the following:
indices = [i for i,d in enumerate(l) if d['title']=='ti']
for i in reversed(indices): # so del doesn't affect later positions
del l[i]
--Scott David Daniels
[email protected]
--
http://mail.python.org/mailman/listinfo/python-list
