variable_1 = 'HELLO'
variable_2 = 'ADIOS'
varlist = [variable_1, variable_2]
var_string = ', '.join('?' * len(varlist))
query_string = 'INSERT INTO table VALUES (%s);' % var_string
cursor.execute(query_string, varlist)
Insert list into my database using Python