HJ50_四则运算_eval()
用Python内置函数eval()
1 import sys 2 a=sys.stdin.readline().strip() 3 a=a.replace("{","(") 4 a=a.replace("}",")") 5 a=a.replace("[","(") 6 a=a.replace("]",")") 7 print(int(eval(a)))
用Python内置函数eval()
1 import sys 2 a=sys.stdin.readline().strip() 3 a=a.replace("{","(") 4 a=a.replace("}",")") 5 a=a.replace("[","(") 6 a=a.replace("]",")") 7 print(int(eval(a)))