This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
1 - 2 * ( (60-30 +(-40/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 )) - (-4*3)/ (16-3*2) ) | |
''' | |
import re | |
calcStr = "1 - 2 * ( (60-30 +(-40/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 )) - (-4*3)/ (16-3*2) )" | |
calcStr = re.sub("\ ","",calcStr) # 清除输入中的空格 | |
sepStr = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def multiplyDivideFunc(inStr): | |
outList = list() | |
if "*" in inStr: | |
# print("Multiply in inStr") | |
outList = inStr.split("*") | |
# print(float(outList[0])*float(outList[1])) | |
return float(outList[0])*float(outList[1]) | |
elif "/" in inStr: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def multiplyDivideFunc(inStr): | |
outList = list() | |
if "*" in inStr: | |
# print("Multiply in inStr") | |
outList = inStr.split("*") | |
# print(float(outList[0])*float(outList[1])) | |
return float(outList[0])*float(outList[1]) | |
elif "/" in inStr: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
1 - 2 * ( (60-30 +(-40/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 )) - (-4*3)/ (16-3*2) ) | |
''' | |
import re | |
calcStr = "1 - 2 * ( (60-30 +(-40/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 )) - (-4*3)/ (16-3*2) )" | |
calcStr = re.sub("\ ","",calcStr) # 清除输入中的空格 | |
sepStr = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
1 - 2 * ( (60-30 +(-40/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 )) - (-4*3)/ (16-3*2) ) | |
''' | |
import re | |
calcStr = "1 - 2 * ( (60-30 +(-40/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 )) - (-4*3)/ (16-3*2) )" | |
calcStr = re.sub("\ ","",calcStr) |