I'm doing a multi-line string saved to the variable str:

str = """
This is a multiline string
"""

When I print str it works fine. But if I print a different multiline string:

`

str = """
This is a multiline string
"""

print str             # Works Fine

str_2 = """

hi/hola!
goodbye               # Backslashes don't work

"""

Can someone help.

There is no backslash in your string, so I don't see the problem. there is only an ordinary slash, which has no special effect. Please describe what you expect.

Hint, overriding the str builtin isn't a very good idea.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.