Help formatting a mysql query string

RiGGa rigga at hasnomail.com
Sat Jun 26 06:45:29 EDT 2004


Hi,

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

Thanks

Rigga



More information about the Python-list mailing list