[Solved] SyntaxError: unexpected character after line continuation character

Note: the above code looks OK on the surface, but an error is reported: syntax error: unexpected character after line continuation character.

The reason for the problem here is:

There is a space after the line break ‘\’ on the first line. When there is a space after the newline character, the program will report an error.

Solution:

Very simple, just delete the spaces after the newline character “\” and the problem is solved.

In other words, nothing else is allowed after the newline character. Include comments#

Similar Posts: