Guys有任何方式可以使用mylist['status']
mylist = {
"results" : [
{
"address_components" : [
{
"long_name" : "Winnetka",
"short_name" : "Winnetka",
"types" : [ "locality", "political" ]
},
],
],
"status" : "OK"
}
答案 0 :(得分:3)
更正您的代码如下(缺少右括号}
)
mylist = {
"results" : [
{
"address_components" : [
{
"long_name" : "Winnetka",
"short_name" : "Winnetka",
"types" : [ "locality", "political" ]
},
],
}
],
"status" : "OK"
}
和之后你可以致电mylist['status']
> mylist['status']
OK
答案 1 :(得分:1)
我已经重新格式化了下面的代码,因此对您来说更有意义:
mylist = {"results" : [{"address_components" : [{"long_name" : "Winnetka",
"short_name" : "Winnetka",
"types" : ["locality", "political"]}]}],
"status" : "OK"}
mylist['status'] # 'OK'