我试图从下面的字典中访问creator的值以及其他值,如description和email。在
我尝试将其转换为json,然后访问密钥。但它没有起作用。是迭代整个字典并获取所有键的值的唯一方法。在
有什么建议都很好!!在
{
"description": xxx,
"email": xxx@scotiabank.com,
"creator": {
"data": [
{
"name": "john"
"id": "123"
},
{
"name": "victor"
"id" : "345"
}
]
}
Tags:
dict["description"]
将返回'xxx'
dict["creator"]['data']
将返回{dict["creator"]['data'][1]["name"]
将返回"john"
你的字典在哪里
假设你有一本任何深度的字典。在
可以通过指定键从字典中获取项:
^{pr2}$可以递归执行此操作:
相关问题 更多 >
编程相关推荐