Created
March 19, 2020 09:22
-
-
Save outiy5/eaf0c1f596265e005787a45c2a6caad9 to your computer and use it in GitHub Desktop.
[convert python string to javascript string] #python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://stackoverflow.com/questions/10395319/python-convert-str-to-javascript-literal-string | |
| import json | |
| jsstring = """ | |
| foo "bar" | |
| """ | |
| print 'function dosomething () { return %s.toLowerCase(); }' % json.dumps(jsstring) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment