これはどちらか間違いなく良い解決策はありませんが、それは一種のクールです。
>>> from urllib.request import urlopen
>>> from bs4 import BeautifulSoup
>>>
>>> data = urlopen('http://docs.python.org/py3k/library/exceptions.html').read()
>>> parsed = BeautifulSoup(data)
>>> exceptions = [x.text for x in parsed.select('dl.exception > dt tt.descname')]
>>> exceptions
['BaseException', 'Exception', 'ArithmeticError', 'BufferError', 'LookupError',
'EnvironmentError', 'AssertionError', 'AttributeError', 'EOFError',
'FloatingPointError', 'GeneratorExit', 'IOError', 'ImportError', 'IndexError',
'KeyError', 'KeyboardInterrupt', 'MemoryError', 'NameError', 'NotImplementedError',
'OSError', 'OverflowError', 'ReferenceError', 'RuntimeError', 'StopIteration',
'SyntaxError', 'IndentationError', 'TabError', 'SystemError', 'SystemExit',
'TypeError', 'UnboundLocalError', 'UnicodeError', 'UnicodeEncodeError',
'UnicodeDecodeError', 'UnicodeTranslateError', 'ValueError', 'VMSError',
'WindowsError', 'ZeroDivisionError', 'Warning', 'UserWarning', 'DeprecationWarning',
'PendingDeprecationWarning', 'SyntaxWarning', 'RuntimeWarning', 'FutureWarning',
'ImportWarning', 'UnicodeWarning', 'BytesWarning', 'ResourceWarning']
(BeautifulSoup 4が必要です)(例外のない固定セットがありません;。新しいものを定義することができます)これらの –