5
在一行中捕获多个异常(块除外)
我知道我可以做到: try: # do something that may fail except: # do this if ANYTHING goes wrong 我也可以这样做: try: # do something that may fail except IDontLikeYouException: # say please except YouAreTooShortException: # stand on a ladder 但是,如果我想在两个不同的异常中做同样的事情,那么我现在想到的最好的方法就是: try: # do something that may fail except IDontLikeYouException: # say please except …