How did you try to insert the variable? The following should work: statement = "INSERT INTO test_table VALUES ('%s', 'test2', 'test3')" % temp Matthias