Python and Javascript equivalence

Prateek surekap at gmail.com
Sun Apr 22 22:29:07 EDT 2007


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))

This works when you want to convert Python objects to Javascript using
JSON. It may work for you.

-Prateek




More information about the Python-list mailing list