Last active
August 4, 2017 04:06
-
-
Save lhsfcboy/6d17397d39c33c498abbeb57ecb60d3e to your computer and use it in GitHub Desktop.
try_catch示例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for filepath in filelist: # filelist中是文件路径的列表 | |
try: | |
with open(filepath, 'r') as f: | |
# 执行数据处理的相关工作 | |
pass | |
print('{} is processed!'.format(filepath)) | |
except IOError: | |
print('{} with IOError!'.format(filepath)) | |
# 异常的相应处理 | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment