Python - Exceptions

官方文档:https://docs.python.org/3/library/exceptions.html

 

1. 使用try...except...

2. 输出错误信息的方式为:

try:
    cursor.execute(sql)
    db.commit()
except Exception as inst:
    print(inst.args)
    db.rollback()

3. 

 

posted @ 2016-09-07 20:48  Jacky Ge  阅读(297)  评论(0编辑  收藏  举报