2011-11-22 90 views

回答

0

您可以使用Python的異常處理:

try: 
    do_something() 
except Exception, ex: 
    print "The process failed because", ex 
    do_something_else() 

更換do_something()的代碼,你首先要嘗試。與你的願望更換do_somthing_else()代碼do_something時嘗試()部分失敗

Reference for Exception Handling