Skip to content

Escape percentage symbol (%) in Strings

Python uses the % symbol in strings as variable placeholder, so you need to escape it. You might expect it to be \%, but actually it’s %%.

[sc name=”src” url=”https://stackoverflow.com/questions/10678229/how-can-i-selectively-escape-percent-in-python-strings” ]

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.