17. python 错误捕捉
try:
file = open('eeee', 'r+')
except Exception as e:
print('there is no file named as eeee')
response = input('Do you want to create a new file')
if response == 'y':
file = open('eeee', 'w')
else:
pass
else:
file.write('ssss')
file.close()
try:
...
except Exception as e:
print(e)

浙公网安备 33010602011771号