the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > you need to pass the SQL statement to execute() method, and the statement of the placeholder substitution for you to insert value.
Here is an example of the modified code:
import pymysql
a = (('666', '666', '666', '666'), ('666', '666', '666', '666'))
mydb = pymysql.connect(host="localhost", user="root", passwd="", database='123')
mycursor = mydb.cursor()
sql = "INSERT INTO 数据 VALUES (%s, %s, %s, %s)"
mycursor.executemany(sql, a)
mydb.commit()
print(mycursor.rowcount, "was inserted.")
mydb.close()
In the above code, we use the %s placeholder to represent the value to be inserted, then replace the placeholder with the value in the a variable in the executemany() method.
It is also recommended that you close the cursor and database connection after inserting the data.