Home > database >  Cannot insert data in mysql-database: 'ValueError: Could not process parameters'
Cannot insert data in mysql-database: 'ValueError: Could not process parameters'

Time:11-16

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