回答編集履歴

2

Update

2021/11/09 13:46

投稿

melian
melian

スコア20655

test CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  for l, v in re.findall(rf'({"|".join(labels.keys())})(.)', text):
22
22
 
23
- labels[l] += vals[v] if v in vals.keys() else 0
23
+ labels[l] += vals[v] if v in vals else 0
24
24
 
25
25
 
26
26
 

1

Update

2021/11/09 13:46

投稿

melian
melian

スコア20655

test CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  for l, v in re.findall(rf'({"|".join(labels.keys())})(.)', text):
22
22
 
23
- labels[l] += vals[v]
23
+ labels[l] += vals[v] if v in vals.keys() else 0
24
24
 
25
25
 
26
26