我有一本字典,其中有一个列表,列表中有 2 个字典:
dict: {
"weather":[
{"id": 701, "main": "Mist", "description": "mist"},
{"id": 300, "main": "Drizzle", "description": "light intensity drizzle"}
]
}
我想在字典中访问light Intensity drizzle
,我该怎么做?
我知道我必须做dict[0]
...但此后我陷入困境
最佳答案
在 JavaScript 中:
dict.weather[1].description
在Python中:
dictVar["weather"][1]["description"]
(Python 需要将 dict
更改为 dictVar
,因为 dict
已被保留)
关于javascript - 如何访问字典中的特定元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57300885/