版本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
意思就是conn.total_changes是个int。result = conn.total_changes 就行,不要加()