assert 1==2,("断言错误") 相当于: if not 1==2: raise AssertionError("断言错误!") 转载于:https://www.cnblogs.com/yibeimingyue/p/11416165.html