AttributeError: 'tuple' object has no attribute 'encode'

Lenard Lindstrom len-l at telus.net
Thu Apr 5 13:12:38 EDT 2007


erikcw wrote:
> Hi,
> 
> I'm trying to build a SQL string
> 
> sql = """INSERT INTO ag ('cid', 'ag', 'test') VALUES(%i, %s, %d)""",
> (cid, ag, self.data[parent][child]['results']['test'])
> 

I am guessing you want the string formatting operator here:

sql = """...""" % (cid, ...)

The comma creates a tuple.





More information about the Python-list mailing list