Code:
db = sqlite3.connect('mydb.db')
f1l = []
f1l = db.execute("SELECT f1 FROM t1").fetchall()
for i in range(0,len(f1l)):
xmlfile = matchf1(f1l[i])
print xmlfile
postcount = 0
for node in xmlfile.getElementsByTagName("t1"):
c1 = node.getAttribute("c1")
if c1 != 0:
for node2 in xmlfile.getElementsByTagName("t2"):
y = node2.getAttribute("t")
x = f1l[i]
db.execute("UPDATE t1 SET f2='%s' WHERE f1='%s'"%(y,x))
print y + " added to" + f1l[i]
db.commit()
db.close()
Traceback (most recent call last):
File "D:\sumthin.py" , line 28, in <module>
db.execute("UPD ATE t1 SET f2='%s' WHERE f1='%s'"%(y,x))
OperationalErro r: near "005": syntax error
The data base got the table "t1" and the fields "f1" and "f2".
In all rows "f1" is filled and "f2" is "none".
Any suggestions?
Comment