Ich versuche, meine Daten von .csv in Mysql-Datenbank mit Python-Skript einzufügen._mysql_exceptions.OperationalError: (1366, "Falscher Integerwert: '% s' für Spalte 'ID' in Zeile 1")
Python-Skript, das ich verwendet
import csv
import MySQLdb
db = MySQLdb.connect(host='localhost',user='root',passwd='password',db='EfficientBazzar')
cursor = db.cursor()
csv_data = csv.reader(file('products.csv'))
for row in csv_data:
cursor.execute('INSERT INTO vendor_price_list(ID,Vendor,productname,productcode,unit,weight,price)' 'VALUES("%s","%s","%s","%s","%s","%s","%s")')
db.commit()
cursor.close()
print "Done"
Danke, es hat funktioniert –
Ich bin froh, dass ich helfen konnte! Bitte akzeptiere die Antwort dann, P. –