我正在尝试查找给定的“ id”(如果它存在于字典中)。问题在于,由于字典的不断增长,我无法预测它的长度。一些雇员可能有空的sub_employee [],但有些雇员将有N个sub_employee。
我的示例词典
datas = {{
"profileid": {
"id": 98,
"first_name": "xxx",
},
"sub_employees": [
{
"profileid": {
"id": 101,
"first_name": "xxx",
},
"sub_employees": [
{
"profileid": {
"id": 102,
"first_name": "xxx",
},
"sub_employees": []
},
{
"profileid": {
"id": 109,
"first_name": "xxx",
},
"sub_employees": [
{
"profileid": {
"id": 110,
"first_name": "xxx",
},
"sub_employees": [
{
"profileid": {
"id": 111,
"first_name": "xxx",
},
"sub_employees": []
}
]
}
]
}
]
}
]
}}
如何查找给定词典中是否存在特定的“ id”