python_112_断言

#断言    如果满足断言的执行程序,如果不满足则抛错误
assert type(1) is int
print('断言正确的话,就继续执行')
# assert type('a') is int     #AssertionError
#以下较为繁琐,所以用上述断言形式
if 1 is not chr:
    exit('退出')
print('还在执行吗?')

 

posted @ 2018-04-23 13:10  耐烦不急  阅读(192)  评论(0编辑  收藏  举报