Python-list Digest, Vol 48, Issue 301

Tim Golden mail at timgolden.me.uk
Thu Sep 20 11:29:36 EDT 2007


Christoph Scheit wrote:
> Hello,
> 
> is there a way to do something like
> for i,j in l1, l2:
>     print i,j

I'm assuming that l1 and l2 are in fact
lists (or at least sequences). If that's
the case:

<code>
l1 = [1, 2, 3]
l2 = ['a', 'b', 'c']

for i, j in zip (l1, l2):
   print i, j

</code>

TJG



More information about the Python-list mailing list