while True:
try:
s=input()
# print(s)
for each in s:
if each in ["+","-","*","/"]:
a,b=map(float,s.split(each))
if each=="+":
print("{:.4f}+{:.4f}={:.4f}".format(a,b,a+b))
elif each=="-":
print("{:.4f}-{:.4f}={:.4f}".format(a,b,a-b))
elif each=="*":
print("{:.4f}*{:.4f}={:.4f}".format(a,b,a*b))
else:
if b==0.0:
print("Wrong!Division by zero!")
else:
print("{:.4f}/{:.4f}={:.4f}".format(a,b,a/b))
break
else:
print("Invalid operation!")
except:
break
```
- split(each) 和判断each in 【】 两个结合,太妙了!