Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JSON输出中文
# 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
You can’t perform that action at this time.