我一直在编写一个 Python 脚本来解析来自 Soundcloud API 的 JSON 信息,我只是想知道当我使用 json.loads(val) 时“u”是什么以及如何将 JSON 信息存储到没有 u 的对象?
即为什么会有你:
>>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]')
[u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
请参阅此处的“解码 JSON”部分以进一步了解我的意思:
最佳答案
Unicode 字符串。见 Python Tutorial .
In Python source code, Unicode literals are written as strings prefixed with the ‘u’ or ‘U’ character: u'abcdefghijk'.
关于python - 当我使用 json.loads 时,你是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9200962/