i=1
cursor.execute(sql1)
results = cursor.fetchall()
for row in results:
try:
key1 = row[1]
key2 = row[2]
key3 = row[3]
key4 = row[4]
if key4 == None:
key4 = ''
# print(key1,key2,key3,key4)
items, cont = get_items_from(key1, key2, key3, key4)
# sql = 'insert into book(item,content) values("%s","%s") where id="%d" ' % \
# (items, cont, i)
sql = """update book set item='%s', content='%s' where \
id = '%d' """ %(items, cont, i)
cursor.execute(sql)
db.commit()
i=i+1
print('none')
except Exception as e:
print(e)
db.close()