Re: [问题] 终止程序

楼主: toki (いまがその时だ)   2014-05-30 16:57:02
※ 引述《aquarius523 (minerva)》之铭言:
: 我想终止程序
: 爬文的结果多是关于while loop、for loop的情况(使用break)
: 但现在我要的是"检查前一个function的结果,并判断是否继续
: 若否 先print一段字串再终止"
: 其中没有用到loop
: 试过break,都会出问题
: 那该怎么解决呢?
: 有没有内建指令?
try:
assert func1(), 'func1 failed'
# if not func1(): raise Exeption('func1 failed')
assert func2(), 'func2 failed'
:
:
except Exception, e:
print str(e)

Links booklink

Contact Us: admin [ a t ] ucptt.com