python dictionary nested list value

dict={'log_id': 5891599090191187877, 'result_num': 1, 'result': [{'probability': 0.9882395267486572, 'top': 205, 'height': 216, 'classname': 'Face', 'width': 191, 'left': 210}]}

Access dict values:

print(dict['log_id'])

Access dict result in a list of values:

Print (dict [ ' Result ' ] [0] [ ' top ' ]) # first value (dictionary) result in a list of top content dict

You can also use temporary variables:

dict1=dict['result']
print(dict1[0]['probability'])

 

Guess you like

Origin www.cnblogs.com/liubingzhe/p/11314724.html