[Tutor] question about a list of lists
shawn bright
nephish at gmail.com
Sun Jan 28 20:39:43 CET 2007
lo there all.
i have a list of lists that i want to build, only if an item is not in the
list already.
kinda like this
new_list = []
for item in lists: # item will look something like [var1, var2, var3]
if item[0] in new_list ( only the first element of each list ) like
new_list[0][0]
basicly, i want to know if item[0] is one of the items[0] in my new_list
whats a good pythonic way to do this? i mean, i have a couple of way to do
this, but they are ugly.
shawn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070128/d1aa7704/attachment.htm
More information about the Tutor
mailing list