Python MySQLdb异常 [英] Python MySQLdb exceptions

查看:164
本文介绍了Python MySQLdb异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚开始掌握python和MySQLdb,并且想知道

Just starting to get to grips with python and MySQLdb and was wondering


  1. / catch块连接到MySQL。在MySQLdb.connect点?还有一次我有什么问题吗?

  1. Where is the best play to put a try/catch block for the connection to MySQL. At the MySQLdb.connect point? Also should there be one when ever i query?

我应该捕捉到任何这些区块的例外情况?

What exceptions should i be catching on any of these blocks?

感谢任何帮助

干杯
标记

推荐答案

捕获MySQLdb.Error,连接时执行查询

Catch the MySQLdb.Error, while connecting and while executing query

这篇关于Python MySQLdb异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆