我有一些代码,它试图插入列表b_result_list
中的每个list-item
:
db = pymysql.connect(host="localhost",user="root",passwd="password",db="garbagedb" )
cursor = db.cursor()
for brl in b_result_list:
try:
sql = """INSERT INTO paths(path) VALUES (brl)"""
cursor.execute(sql)
db.commit()
print("inserted: {}".format(brl))
except:
print("error inserting")
db.rollback()
db.close()
我似乎不明白它为什么不起作用。在
我测试了query manually
,它工作得很好。在
有人看见什么了吗?谢谢
我花了一些时间想弄清楚这个,但最后还是弄明白了。在
这是我的工作实例:我希望有一天它能帮助到某人!在
更多信息如下:https://github.com/PyMySQL/PyMySQL/blob/master/docs/source/user/examples.rst
相关问题 更多 >
编程相关推荐