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!")

 

 

 

raise TdmsFileMissedExceptin(datapath + '/' + id)
posted @ 2020-12-29 17:10  bH1pJ  阅读(35)  评论(0)    收藏  举报