[英]meaning of the returned list of python json
I'm new to python so I really don't know the language very well. 我是python的新手,所以我真的不太了解该语言。
the following example was taken from here http://docs.python.org/library/json.html 以下示例摘自此处http://docs.python.org/library/json.html
>>> import json
>>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]')
[u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
what does the u mean? 你是什么意思? and how do i know which elements are available in the dictionary?
以及我怎么知道字典中有哪些元素?
Ignacio's answer a bit more verbose (no upvotes to me) 伊格纳西奥(Ignacio)的回答更加冗长(对我无投票)
u'something' means that 'something' is a unicode string, and not for instance an ascii string. u“某物”表示“某物”是unicode字符串,而不是ascii字符串。 Generally text is encoded as 8-bit characters, and you need an encoding to properly interpret/display it.
通常,文本被编码为8位字符,并且您需要进行编码才能正确解释/显示它。 Unicode is 16-bit and doesn't need seperate encodings for the various locale dependent characters.
Unicode是16位的,不需要为各种与语言环境有关的字符进行单独的编码。
In a dictionary (enclosed by {}) the key is the part before the ":" and the value comes after. 在字典(由{}包围)中,键是“:”之前的部分,而值在其后。
You got a list, with elements: 您将获得一个包含以下元素的列表:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.