newbie: how to loop through multiple lists
Padraig Brady
Padraig at Linux.ie
Wed Oct 2 06:16:14 EDT 2002
Alexander Eisenhuth wrote:
> Hallo alltogether,
>
> is there a expression to loop through two lists in one iteration? For
> instance:
>
> --
> l1 = ['a', 'b', 'c', 'd']
> l2 = [ 1, 2, 3, 4]
>
> for lChar, lNumb in (l1, l2):
> print lCnt, ':', lChar
> --
> I hope you understand what I need .
How about:
for index in range(0,len(l1)):
print l1[index], ':', l2[index]
Pádraig.
More information about the Python-list
mailing list