【发布时间】:2021-06-08 16:39:33
【问题描述】:
我有下面的字典,我需要提取“红色”和“蓝色”值作为列表,可能有比这两个更多的值。
输入:
js = {
"accounts": {
"red": {
"client_id": "123",
"client_secret": "123",
},
"blue": {
"client_id": "123",
"client_secret": "123",
}
}
}
预期输出:
["red","blue"]
【问题讨论】:
-
到目前为止你尝试了什么?
-
看这个:
dict.keys -
@gribvirus74 谢谢,它有效
-
list(js['accounts'])?
标签: python json dictionary