• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes

Problem :

My Python program is giving below error
python unexpected character after line continuation character
by (6.9k points)  

1 Answer

0 votes


Here backslash \ is the line continuation character the error message is talking about, and after it, only newline characters/whitespace are allowed

print "This is a very long string that doesn't fit" + \
      "on a single line"

Outside of a string, a backslash can only appear in this way. For division, you want a slash: /.

If you want to write a verbatim backslash in a string, escape it by doubling it: "\\"

Further Readings:


by (36.1k points)  
edited by