Tim Chase wrote:
> On 2014-08-27 23:42, MRAB wrote:
>> How many parameters are there? len(self.param)
>>
>> Make that many placeholders and then join them together with commas:
>>
>> ', '.join(['?'] * len(self.param))
>
> I prefer the clarity of Peter Otten's suggestion of
>
> ', '.join('?' * len(self.param))
>
> over the mild obscurity of putting it in a list before multiplying.
As long as the OP doesn't try to transfer this to other paramstyles:
>>> ", ".join(["%s"]*3)
'%s, %s, %s'
>>> ", ".join("%s"*3) # OOPS
'%, s, %, s, %, s'
--
https://mail.python.org/mailman/listinfo/python-list