How to get string objects instead of Unicode from JSON?

前端 未结 21 1085
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 14:43

I\'m using Python 2 to parse JSON from ASCII encoded text files.

When loading these files with either json or simplejson, all my

21条回答
  •  一整个雨季
    2020-11-22 15:34

    Check out this answer to a similar question like this which states that

    The u- prefix just means that you have a Unicode string. When you really use the string, it won't appear in your data. Don't be thrown by the printed output.

    For example, try this:

    print mail_accounts[0]["i"]
    

    You won't see a u.

提交回复
热议问题