sort and delete ?

matt matt at virtualspectator.com
Tue May 30 12:05:00 CEST 2000


Hi, 
Is there a more "pythonic" way to do the following, which, before I make a mess
is, suppossed to assess whether to throw elements out of a list and then
actually do so.  I use a rather strange, but database-like, list.

a = [['egg', [1, 'ace', 3]], ['apple', [1, 'two', 3]], ['pear', [4, 'three',
6]], ['orange', [5, 'two', 1]]]

x=[]
for i in a:
	if i[0][1] in ('ace','three'):
		x.append(i)


regards
Matt




More information about the Python-list mailing list