Reoedering indexes in list of list
Arnaud Delobelle
arnodel at gmail.com
Tue Sep 28 15:46:58 EDT 2010
Toto <emayssat at gmail.com> writes:
>> If your "alias" can be read-only:
>> alias = zip(*myList)
>
>
>
> a=[['00','01'],['10','11']]
> l=zip(*a)
> print(l)
>
> returns... [('00', '10'), ('01', '11')]
>
> IS NOT AT ALL WHAT I WANT ;-)
>
> What I want is
>
> print a[1][0]
> '10'
> but print l[1][0]
> '01'
>
> notice the indexes of the list l are inverted...
Ahem...
>>> a = [['00', '01'], ['10', '11']]
>>> l = zip(*a)
>>> a[1][0]
'10'
>>> l[1][0]
'01'
Looks *exactly* like what you want to me. It doesn't take that long to
check.
--
Arnaud
More information about the Python-list
mailing list