Forráskód Böngészése

table识别问题

chencheng 11 hónapja
szülő
commit
079644ae2b
1 módosított fájl, 6 hozzáadás és 2 törlés
  1. 6 2
      cores/post_decorators.py

+ 6 - 2
cores/post_decorators.py

@@ -9,7 +9,9 @@ def rule1_decorator(f, *args, **kwargs):
     '''
     predict_line = args[1]
     predict_line = f(*args, **kwargs)
-    idx = predict_line.index('')
+    idx = 0
+    if '' in predict_line:
+        idx = predict_line.index('')
     try:
         if idx == 1:
             if '项目' in predict_line[0] and '每100克' in predict_line[2]:
@@ -97,7 +99,9 @@ def rule6_decorator(f, *args, **kwargs):
     '''
     predict_line = args[1]
     predict_line = f(*args, **kwargs)
-    idx = predict_line.index('')
+    idx = 0
+    if '' in predict_line:
+        idx = predict_line.index('')
     try:
         if idx == 1:
             if '项目' in predict_line[0] and '每份' in predict_line[2] and '营养素参考值' in predict_line[2]: