我使用的是python3tkinter和sqlite
我在tkinterText Widget
中有数据,然后我需要将其拆分并保存在数据库表中这是我的代码
data = txtReceipt.get("4.0" ,"end")
for line in data.splitlines()[2:-2]:
no = line.split()[2:3]
name = line.split()[1:2]
price = line.split()[3:4]
series = line.split()[:1]
print(no)
c.execute("INSERT INTO billed_items(item_name,billed_qty,price,item_bill_series) VALUES(?,?,?,?)",(name),(no),(price),(series))
conn.commit()
但是我收到了这个错误信息TypeError: function takes at most 2 arguments (5 given)
需要帮忙吗
这里也是当我试图读回文本小部件的时候
su=c.execute("SELECT * FROM billed_items")
for row in su:
text = str(row)
txtReceipt.insert("end",str(row[0])+" "+str(row[1])+'\t\t'+str(row[2])+'\t'+" "+str(row[3])+"\n")
在那里它只读表中的最后一行我不知道为什么他不能读所有的行
值需要在元组中提供。试试这个
//sqlite3.OperationalError: near "%": syntax error?
相关问题 更多 >
编程相关推荐