错误姿势:
#连续输入多个数
x = eval(input("请输入1个数"))
print(x)
请输入1个数
Traceback (most recent call last):
File "D:/Python/day2/input.py", line 2, in <module>
x = eval(input("请输入1个数"))
File "" , line 0
^
SyntaxError: unexpected EOF while parsing
正确姿势:
#连续输入多个数
try:
x, y, z = eval(input("请输入3个数,分割如1,2,3"))
print(x, y, z)
except:
print("输入有误如1,2,3")
finally:
try:
x = eval(input("请输入1个数"))
print(x)
except:
print("输入有误")