Raise two errors at the same time

后端 未结 6 1200
一个人的身影
一个人的身影 2021-02-19 03:10

Is there any way to raise two errors at the same time by using try and except? For example, ValueError and KeyError.

How do I do that?

6条回答
  •  南方客
    南方客 (楼主)
    2021-02-19 03:53

    try :
        pass
    except (ValueError,KeyError):
        pass
    

    read more about Handling exceptions

提交回复
热议问题