Home > Blockchain >  don't insert data in database mysql
don't insert data in database mysql

Time:11-15

I have a list like this:

prices= ['$22,999', '$7,499', '$33,000', '$6,000', '$34,600', '$8,999', '$6,200', '$7,975']

I want to insert this list to database like this:

sql = "INSERT INTO abc (a) VALUES (%s)"
mycursor.executemany(sql, prices)

but I get error, why?

 ValueError: Could not process parameters

CodePudding user response:

Transform list to list of tuples :

pricesTuples = [(p,) for p in prices]
  • Related