python中try-except用法

try:
  # 一些可能引发异常的操作
except ValueError as e:
  # 处理特定的值错误异常
except FileNotFoundError as e:
  # 处理文件未找到异常
except Exception as e:
  # 处理其他所有类型的异常

posted on 2023-11-23 15:16  peijiao  阅读(34)  评论(0)    收藏  举报