Quoting backslashes in Python string literals

Posted on

Question :

Quoting backslashes in Python string literals

I have a string that contains both double-quotes and backslashes that I want to set to a variable in Python. However, whenever I try to set it, the quotes or slashes are either removed or escaped. Here’s an example:

>>> foo = 'baz ""'

Leave a Reply

Your email address will not be published.