Python 自定义异常

Python 自定义异常

 

#1.用户自定义异常类型
class TdmsFileMissedExceptin(Exception):
    "this is user's Exception for check the length of name "
    def __init__(self,path):
        self.path = path
    def __str__(self):
        print("The tdms files in "+str(self.path)+"is missed!")
posted @ 2020-12-29 17:09  bH1pJ  阅读(28)  评论(0编辑  收藏  举报