The backslash is the line continuous character, about the error message is talking and after it, only the new line characters and white spaces are allowed. Before the next non-whitespace continuous the “interrupted” line.
print “This is the very long sentence and does not seems to be fit “ \
“on a single line”.
Multiple string literals:
If the multiple string literals are written sequentially, then they can be concatenated into one string like;
s = 'aaa' 'bbb'
We can write the long string into multiple lines of code as follows;
Strings surrounded by “”:
Only the string literals that are surrounded by ‘’ or “” can be concatenated if they are written consecutively. Note that in this case of variables error can occur;
s_var = 'xxx'
# s = 'aaa' s_var 'bbb'
# SyntaxError: invalid syntax
Use the + operator to concatenate the variables, or the variables and string literals;
s = 'aaa' + s_var + 'bbb'
You need to use the + operator to concatenate the variables, even if they are separated by a backslash (\).
s = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'\