Last active
September 9, 2015 02:03
-
-
Save ficapy/bb3be2fb52ae00ec0ffc to your computer and use it in GitHub Desktop.
JSON输出中文
This file contains 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
# http://stackoverflow.com/questions/18337407/saving-utf-8-texts-in-json-dumps-as-utf8-not-as-u-escape-sequence | |
print(json.dumps({u'卧槽': u'卧槽'}, indent=4).decode('unicode-escape').encode('utf8')) | |
print(json.dumps({u'卧槽': u'卧槽'}, indent=4, ensure_ascii=False)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment