Referencing Items in a List of Tuples

Paul Rubin http
Sat Feb 24 21:26:30 EST 2007


"Rune Strand" <rune.strand at gmail.com> writes:
> if you want numeric adressing, try:
> for i in range(len(mainlist)):
>    if mainlist[i][0] == 'eco'  etc.

Preferable:

    for i,m in enumerate(mainlist):
       if m[0] == 'eco' etc.



More information about the Python-list mailing list