You can escape the backslash with another backslash (\\), but it won’t look nicer. To solve that, put an r in front of The string to signal a raw string. A raw string will ignore literally everything , which is a bad thing if you also want colored text, and really bad if your string contains some quotes like this:
a_and_b = r”Alice’s friend is Bob. He always says, \“howdy\” ”
In this case, python will throw a SyntaxError...
If you haven’t figured out how to solve it, here it is:
a_and_b = r”””Alice’s friend is Bob. He always says, \“howdy\” ”””
In here, we use a multiline string. And if the string has 3 quotes in a row, then that’s easy. Put a space between them and it’s solved:
three_quotes = ’’’ Here are 3 single quotes: ‘ ‘ ‘ ’’’