当我运行这段代码时,我希望程序在打印“ EASTER EGG”之后结束。相反,代码会在try中中断,except并打印“找不到文件”。有人可以帮忙吗?谢谢。
finp=input('File name: ')
try:
if finp=='easter egg':
print('EASTER EGG')
exit()
else:
file=open(finp,'r')
except:
print('File not found. Please enter a valid file name.')
exit()
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句