cari

Rumah  >  Soal Jawab  >  teks badan

python - 使用sqllite的conn.total_changes()问题

版本3.5

def Exec(self, sql, param=None):
        conn = sqlite3.connect(self.path)
        try:
            if param is None:
                conn.execute(sql)
            else:
                conn.execute(sql, param)
            conn.commit()
        except Exception as err:
            print(err)
        finally:
            result = conn.total_changes()
            conn.close()
        return result

sql 是 insert into Config values(null,'aaa','aaa','2017-03-30',0)
然后
result = conn.total_changes()
位置报错
'int' object is not callable

黄舟黄舟2786 hari yang lalu688

membalas semua(1)saya akan balas

  • 天蓬老师

    天蓬老师2017-04-18 10:32:05

    Ini bermakna conn.total_changes ialah int. Hanya hasil = conn.total_changes, jangan tambah ()

    balas
    0
  • Batalbalas