2017年10月3日 星期二

Python - 例外處理筆記

用法

try:
f = open('cool', 'r') # mode code is supposed to be 'w'
f.write('Test text')
except Exception as e:
print('Error:{}'.format(e))
else:
        print('success')
finally:
print('finally')

沒有留言:

張貼留言