How transmit python's string to js script
I try to use module json for this, but js script and firebug get errors. Example. I have this line:
{"fruit":{"apple":100}}
i try send it to js script called jquery.ocupload-1.1.2.js
for build selectors.
And i get what all "
become "
and i have an error:
'Unexpected token &'
And then i try json.dumps its escapes all "
like \"
and script dont working with this structs.
How i can make "clean" json struct like {开发者_开发技巧"fruit":{"apple":100}}
without any escapes and extra characters?
Solved. I use Mako for templates. And need switch off filters in it like
${my_var | n}
http://www.makotemplates.org/docs/filtering.html
No, this is not true.
>>> import json
>>> json.dumps({"fruit":{"apple":100}})
'{"fruit": {"apple": 100}}'
So you are clearly doing something else, which you haven't stated in your question.
精彩评论