convert python List to javascript array

Vineet Deodhar d_vineet at
Fri Sep 2 17:34:25 CEST 2011

Hi !
Within a web framework, I want want to pass a python sequence (list or tuple) to client-side javascript function as an array (javascript compatible)
e.g., I have this list:
L = ['spam', 'ham', 'eggs', 12, (13.63)]
What is the correct way to convert L to javascript array format? 

1) jsonify the list and pass it to javascript
(whether json format & javascript array are similar?)

>> import array
>> y = array.array(i, L)
 then return y to javascript function
But the problem with this method is, it will give an array of basic values only.

3) Any other alternative?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list