From c399e7906e2212b8b479ce1fcde0533ea7345393 Mon Sep 17 00:00:00 2001 From: weilinfox Date: Thu, 5 Mar 2020 13:46:10 +0800 Subject: [PATCH] fix some bug --- worker/bc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/worker/bc.py b/worker/bc.py index 5648e96..1228be8 100644 --- a/worker/bc.py +++ b/worker/bc.py @@ -184,7 +184,10 @@ def bcMain(com): com = com.replace("()", "") com = com.replace("x", "*") com = com.replace("X", "*") - + + if (len(com) < 1): + return reportErr(1, "这") + #省略乘号的支持 for i in range(1, len(com)-1, 1): if (com[i] == '(' and (com[i-1].isdigit() or com[i-1] == '.' or com[i-1] == '%' or com[i-1] == ')')): @@ -194,7 +197,7 @@ def bcMain(com): #部分情况开头加0 if (com[0] == '+' or com[0] == '-' or com[0] == '.'): com = '0' + com - + #print(com) #表达式合法性