help with creating a mysql query string

RiGGa rigga at
Sun Jun 27 10:49:37 CEST 2004


I am trung to create a mysql query string that contais two variables, the
first holds a table name and the second holds the values as a tuple.  I
have tried the following however I can not work out how to get the format
right so the %s is subsituted with the contents of the variable, I think I
just have the quoting wrong, can anyone advise?

tablename contains the table I want to use
datavalue contains the data I want to use (contains multiple fields, we will
say 3 here for this example)

sqlquery = "INSERT INTO %s", tablename + " values(%s,%s,%s)", datavalue"

Any help appreciated



More information about the Python-list mailing list