-1

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

Lyra Orwell
  • 908
  • 2
  • 12
  • 35

2 Answers2

2

If you do

print("\")

you are escaping the final quote.

You need to escape the backslash.

print("\\")
blueteeth
  • 3,110
  • 1
  • 11
  • 21
1

It is simple, just escape the escape character itself:

print("\\")