【发布时间】:2021-02-10 09:07:55
【问题描述】:
假设我在一个列表中有这本字典:
[
{
"Name": "Person",
"Confidence": 97.56156921386719,
"Instances": [
{
"BoundingBox": {
"Width": 0.6137702465057373,
"Height": 0.9175498485565186,
"Left": 0.22297996282577515,
"Top": 0.0739903450012207
},
"Confidence": 94.51961517333984
},
{
"BoundingBox": {
"Width": 0.46570318937301636,
"Height": 0.6405649781227112,
"Left": 0.11447866261005402,
"Top": 0.34079012274742126
},
"Confidence": 82.2153549194336
}
],
"Parents": []
},
{
"Name": "Human",
"Confidence": 97.56156921386719,
"Instances": [],
"Parents": []
},
{
"Name": "Clothing",
"Confidence": 91.08417510986328,
"Instances": [],
"Parents": []
}
}]
我怎样才能只检索键值为 "Name":"Clothing" 的字典?是否可以从字典中检索它? “服装”键可以出现在列表的任何部分。
{
"Name": "Clothing",
"Confidence": 91.08417510986328,
"Instances": [],
"Parents": []
}
【问题讨论】:
标签: python json list dictionary