我有一个问题,从Python插入到SQLite3数据库的值。以下代码以不同方式插入新行。从Python 2.7插入不一致的SQLite3
m.execute("INSERT INTO transactions VALUES "+str((timestamp,address,recipient_input,amount_input,signature_enc,public_key_readable,openfield_input))+"")
m.execute("INSERT INTO transactions VALUES ('" + str(timestamp) + "','" + str(address) + "','" + str(recipient_input) + "','" + str(amount_input) + "','" + str(signature_enc) + "','" + str(public_key_readable) + "','" +str(openfield_input) + "')")
第二个示例正确地将新行插入到SQLite数据库中,第一个示例插入“\ n”符号。这有什么解释吗?我想使用第一个使用元组的模型,但没有用“\ n”符号替换新行。
完美,谢谢! – HCLivess