这个里面怎么统计“吸烟”的个数
result ={'person_info':[{'attributes': {'smoke': {'score': 0.9999989867210388, 'name': '吸烟'}}}, {'attributes': {'smoke': {'score': 0.9933449029922485, 'name': '未吸烟'}}}, {'attributes': {'smoke': {'score': 0.9619882702827454, 'name': '未吸烟'}}}]}
回答:
result ={'person_info':[{'attributes': {'smoke': {'score': 0.9999989867210388, 'name': '吸烟'}}}, {'attributes': {'smoke': {'score': 0.9933449029922485, 'name': '未吸烟'}}}, {'attributes': {'smoke': {'score': 0.9619882702827454, 'name': '未吸烟'}}}]}smokec=0
clen=len( result['person_info'] )
for i in range(clen):
if ( result['person_info'][i]['attributes']['smoke']['name'] == '吸烟') :
smokec+=1
print(smokec)
以上是 这个里面怎么统计“吸烟”的个数 的全部内容, 来源链接: utcz.com/p/938179.html