开发者

python sqlite3 not working

开发者 https://www.devze.com 2023-03-09 20:16 出处:网络
try: c = db.cursor() c.execute(\"insert or replace into registrations values \" + \"(?, ?, datetime(\'now\'))\", (user, identity))
try:
    c = db.cursor()
    c.execute("insert or replace into registrations values " +
              "(?, ?, datetime('now'))", (user, identity))
    print '\t<update>开发者_Go百科true</update>'
except Exception,inst:
    print inst.args

insert create table not working. How do I fetch the exception details?


If you read this Python PEP, it should describe the exception classes for the Sqlite Python module.

Have you tried something like this:

try:
  db_cursor.execute('some hopefully valid SQL;')
except sqlite3.Error, msg:
  print msg
0

精彩评论

暂无评论...
验证码 换一张
取 消