簡體   English   中英

使用Python MYSQL.Connector在MySQL表中插入時出錯

[英]Getting error while inserting in MySQL table using Python MYSQL.Connector

這是我的代碼:

sql = "INSERT INTO haircolor (x_pos, y_pos, width, height,filename,hair_color) VALUES (%s, %s, %s, %s, %s, %s)"

print ("Values",(x_pos, y_pos, width, height,filename,hair_color))
mycursor.execute(sql, (x_pos, y_pos, width, height,filename,hair_color))
mydb.commit()

輸出:

值:33.897543,28.304444444444444,2.7566544,4.9043634,'1(copy1).jpg ,黑色`

錯誤

處理格式參數失敗python'str_'無法轉換為mysql類型

看起來好像你的文件名和發色變量中有未轉義的后引號......這對任何事都沒有幫助......

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM