[Solved] Appeding different list values to dictionary in python


Maybe use zip:

for a,b,c in zip(scores,boxes,class_list):
   if a >= 0.98:
       data[k+1] = {"score":a,"box":b, "class": c } ;
       k=k+1;
print("Final_result",data)

Output:

Final_result {2: {'score': 0.98, 'box': [0.1, 0.2, 0.3, 0.4], 'class': 1}}

Edit:

for a,b,c in zip(scores,boxes,class_list):
   if a >= 0.98:
       data[k+1] = {"score":a,"box":b, "class": int(c) } ;
       k=k+1;
print("Final_result",data)

9

solved Appeding different list values to dictionary in python