Gregory Piñero wrote:
> How do I put % in a format sting?
>> For example I want this to work:
>>>>> sql_template="""SELECT ENTRY FROM LOOKUP WHERE FIELDNAME LIKE '%s%V'"""
>>>> sql_template % 'userdef103'
> Traceback (most recent call last):
> File "<interactive input>", line 1, in ?
> TypeError: not enough arguments for format string
>>>
Put it immediately after the string:
sql_template="""SELECT ENTRY FROM LOOKUP WHERE FIELDNAME LIKE '%s%V'"""
% 'userdef103'
But I think SQL has other recommended methods. At least with SQLite, it
is recommended you not use Python's %s formatter but instead the "?"
formatter.