-1

I use print() function to use like this:print("\")and i get an exception. Tell me how to slove it. Thks

hUwUtao
  • 76
  • 8
  • 1
    Backslash is an escape character, so if you want a literal backslash just escape it: "\\". Otherwise your string is not a complete string: the second " is interpreted as being *part of the string* (and everything after it like the close paren is as well) rather than the delimiter. Which is why you get the error, you have an unterminated string. – Jared Smith Apr 12 '20 at 13:04

2 Answers2

1

Use \\ instead.

Actually, \ is a special character and you have to escape it.

print("\\") # print a single "\" character
BalooRM
  • 434
  • 1
  • 6
  • 15
Ambitions
  • 2,369
  • 3
  • 13
  • 24
-1

Use:

print("\\")

instead of print("\")

S.SavaS
  • 65
  • 1
  • 1
  • 8