how to iterate over several lists?
ben+python at benfinney.id.au
Fri Jun 5 06:30:05 CEST 2009
Chris Rebert <clp2 at rebertia.com> writes:
> On Thu, Jun 4, 2009 at 9:07 PM, kj<no.email at please.post> wrote:
> > Suppose I have two lists, list_a and list_b, and I want to iterate
> > over both as if they were a single list.
> Just add the lists together.
> for x in list_a + list_b:
Which, more precisely, creates a *new* list as the concatenation of the
two existing lists.
\ “A good politician is quite as unthinkable as an honest |
`\ burglar.” —Henry L. Mencken |
More information about the Python-list