python中抛出异常两种方式

assert 1 > 2,'1不大于2'

抛出异常:AssertionError: 1不大于2

    if not 1 > 2:
        raise Exception('1不大于2')

抛出异常:Exception: 1不大于2