首页 > 代码库 > Python - Exceptions

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. 

 

Python - Exceptions