example
try: x= "" x = input("input x: ") print (x) except EOFError as e: print (x) print ("end")
在Python 3中运行此代码会产生以下输出:
result
这两行输出来自EOFError处理程序。看起来,input()函数将提示符作为数据读取。请帮帮忙。
EOFError
发布于 2019-09-19 23:27:04
您正在打印异常中的x,您应该正在打印e
try: x= "" x = input("input x: ") print (x) except EOFError as e: print (e) print ("end")
https://stackoverflow.com/questions/58014186
相似问题