我正在尝试将当前日期替换为sqlite3中的表。我可以插入它,但如果我试图替换它,这个错误就会出现:TypeError:function正好接受2个参数(给定3个)。你知道吗
maclist = get_dict.get('maclist')
signallist = get_dict.get('signallist')
data_list = list(zip(maclist, signallist))
conn = sqlite3.connect('db/users.db')
c = conn.cursor()
if (id == 1):
try:
c.executemany("INSERT INTO node2 (MAC,SIGNAL,FECHA) VALUES(?,?,?)", data_list, datetime.now())
except Exception as exc:
c.executemany("REPLACE INTO node2 (MAC,SIGNAL,FECHA) VALUES(?,?,?)", data_list, datetime.now())
正确用法是
如果行不存在,INSERT或REPLACE将插入,如果行不存在,则替换值。你知道吗
相关问题 更多 >
编程相关推荐