Python MySQLdb exceptions

后端 未结 2 1170
忘掉有多难
忘掉有多难 2021-02-14 19:19

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

  1. Where is the best play to put a try/catch block for the connection to MySQL. At the MySQ

相关标签:
2条回答
  • 2021-02-14 19:52

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

    0 讨论(0)
  • 2021-02-14 20:12

    I think that the connections and the query can raised errors so you should have try/excepy for both of them.

    0 讨论(0)
提交回复
热议问题