How do you print \ in python

Lyra Orwell :

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 ()?

blueteeth :

If you do

print("\")

you are escaping the final quote.

You need to escape the backslash.

print("\\")

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=33321&siteId=1