首页 > 为什么断言没有像预期那一天报错

为什么断言没有像预期那一天报错

age=10
assert 0<age<10
age=-1
assert 0<age<10,'the age must be realistic'

第2行就结束了,没有到第4行

age=10
assert 0<age<10, 'the age is not in 1~9'
age=-1
assert 0<age<10,'the age must be realistic'

第二行断言失败,终止了

【热门文章】
【热门文章】