我有一个API调用的输出,我想加倍循环。 我有兴趣知道每张照片中最小的人的年龄。
例如:
# photo 1 has 4 people with the age of [38,31,4,5]
# photo 2 has 6 people with the age of [42,68,50,47,6,7]
# the resoult should be [4,6]
这是到目前为止的循环:
temp = []
#loop over number of images
for i in range(len(response_microsoft)):
#loop over number of people in each image
for l in range(len(response_microsoft[i].json())):
temp.append(response_microsoft[i].json()[l]['faceAttributes']['age'])
这给了我
temp = [38.0, 31.0, 4.0, 5.0, 42.0, 68.0, 50.0, 47.0, 6.0, 7.0]
我尝试添加第二个变量,但没有成功。 有人可以帮我吗?