How do you print in python

Question:

I would like to print a backslash character:


But whne I try to use escape characters

print("")

I get a syntax error. I have looked into ecape characters, however is their a specific one for backslash ()?

Asked By: Lyra Orwell

||

Answers:

It is simple, just escape the escape character itself:

print("\")
Answered By: Kasper Davidsen

If you do

print("")

you are escaping the final quote.

You need to escape the backslash.

print("\")
Answered By: blueteeth
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.