Escaping confusion with Python 3 + MySQL

Steve D'Aprano steve+python at pearwood.info
Sun Mar 26 10:40:33 EDT 2017


On Mon, 27 Mar 2017 01:24 am, Νίκος Βέργος wrote:


> I MEAN HOW TO DIFFERENTIATE '%S' FROM LITERAL '%' character.

Use %% for a literal percent character.


py> '%s %% %s' % ('hello', 'world')
'hello % world'



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.



More information about the Python-list mailing list