python string, best way to concat
Tim Chase
python.list at tim.thechases.com
Wed Aug 27 18:44:46 EDT 2014
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.
-tkc
More information about the Python-list
mailing list