这是我的密码:
import mysql.connector
import datetime
import dateutil.parser
import soundfile as sf
mydb = mysql.connector.connect(
host="localhost",
user="py",
password="12345678",
database="mydatabase"
)
mycursor = mydb.cursor()
print(res )
val = res
sql = """INSERT INTO customers (adress) VALUES (%s) """
mycursor.executemany(sql, val)
mydb.commit()
print(mycursor.rowcount, "record inserted.")
列表的值为
['2021-05-21 04:00:32.071', '2021-05-21 04:00:33.071', '2021-05-21 04:00:34.071', '2021-05-21 04:00:35.061', '2021-05-21 04:00:36.071', '2021-05-21 04:00:37.071', '2021-05-21 04:00:38.071', '2021-05-21 04:00:39.061', '2021-05-21 04:00:40.071', '2021-05-21 04:00:41.071', '2021-05-21 04:00:42.071', '2021-05-21 04:00:43.061', '2021-05-21 04:00:44.071', '2021-05-21 04:00:45.071']
下面是错误:
ProgrammingError: Not all parameters were used in the SQL statement
完整列表未设置为asd列,因此我们使用循环herwe is代码:
相关问题 更多 >
编程相关推荐