hi simon thanks for your reply what if i want to do this feed_list=[] feed_id=[] for ix in feeds_list_select: global feeds_list global feeds_id feeds_list.append(ix.url) feeds_id.append(ix.id)
ie not one variable but more variables thanks Simon Forman wrote: > a wrote: > > can someone tell me how to use them > > thanks > > basically, a list comprehension is just like a for loop, if you wrote > it out the "long way" it would be something like this: > > results = [] > for var in some_iterable: > if some condition: > results.append(some expression) > > > The list comprehension version: > > results = [some expression for var in some_iterable if some condition] > > > There's more to it, but that's the basic idea. > > Hope this helps, > ~Simon -- http://mail.python.org/mailman/listinfo/python-list