26.11 Python如何合并except块
https://scz.617.cn/python/201411181234.txt
Q:
except socket.timeout : pass except socket.gaierror : pass except socket.error : pass
Python的except块有下落式处理或者其他什么合并方式吗?
A: zz@nsfocus 2014-11-18
except ( socket.timeout, socket.gaierror, socket.error ) : pass
except ( socket.error, struct.error ), e : sys.stderr.write( 'Line[%u]: %s\n' % ( sys.exc_info()[2].tb_lineno, str( e ) ) )