Python and Javascript equivalence
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Mon Apr 23 03:40:10 EDT 2007
In <1177295347.006598.168930 at n59g2000hsh.googlegroups.com>, Prateek wrote:
> Try creating a dict with sequential numeric keys.
>
> If you already have a list called my_list, you can do:
>
> com_array = dict(zip(range(len(my_list)), my_list))
com_array = dict(enumerate(my_list))
That doesn't create the intermediate lists.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list