Escaping confusion with Python 3 + MySQL

INADA Naoki songofacandy at gmail.com
Sun Mar 26 10:38:35 EDT 2017


I used space only for readability.  It's not required.

>>> '%%%s%%' % (42,)
'%42%'

On Sun, Mar 26, 2017 at 11:35 PM, Νίκος Βέργος <me.on.nzt at gmail.com> wrote:
> i have tried that 2 days ago.
>
> Problem is that you maintained space before and after '%s'  which wont work
> within like
>
> How would you type it without space as in "%%s%" ?
>
> Στις Κυρ, 26 Μαρ 2017 στις 5:32 μ.μ., ο/η INADA Naoki
> <songofacandy at gmail.com> έγραψε:
>>
>> > I MEAN HOW TO DIFFERENTIATE '%S' FROM LITERAL '%' character.
>> >
>>
>> >>> '%% %s %%s' % (42,)
>> '% 42 %s'
>>
>> Use %%
>
> --
> What is now proved was at first only imagined!


More information about the Python-list mailing list