0

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

Hutao
  • 78
  • 7
  • 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
  • 390
  • 4
  • 12
Ambitions
  • 1,980
  • 3
  • 11
  • 22
-1

Use:

print("\\")

instead of print("\")

S.SavaS
  • 45
  • 1
  • 7