grammar = {
'expert' : {
'min_time' : 30,
'filtered_thresholds' : {'A':10,'B':10,'C':10,'D':10,'E':20,'I':10,'T':10,'H':10,'K':0,'J':0,'L':0,'M':0,'N':0,'O':0,'P':0,'Q':0,'R':0,'S':0},
'filter_screens' : ['H','I','J','K','L','M','N','O','P','Q','R','S']
},
'expert2' : {
'min_time' : 2,
'filtered thresholds' : {'A':10,'B':10,'C':10,'D':10,'E':20,'I':10,'T':10,'H':10,'K':0,'J':0,'L':0,'M':0,'N':0,'O':0,'P':0,'Q':0,'R':0,'S':0},
'filter screens' : ['H','I','J','K','L','M','N','O','P','Q','R','S']
}
}
for i in grammar:
for j in grammar[i]:
min_time = j['min_time']
filtered_thresholds_expert = j['filtered_thresholds']
filtered_screens = j['filtered_screens']
ProcessThresholds(time_per_screen_percentage)
我想「MIN_TIME」分配給MIN_TIME,「filtered_thresholds」來filtered_thresholds_expert和「filtered_screens」到filtered_screens。
然而,我得到這個錯誤
分配字典鍵的值給另一個變量
min_time = j['min_time']
TypeError: string indices must be integers, not str