0.8 C
New York
Monday, February 26, 2024

SyntaxError: unexpected character after line continuation character in Python

A common error in Python is the “SyntaxError: unexpected character after line continuation character”. This usually occurs when the compiler finds a character that is not supposed to be after the line continuation character.

Let us understand this a little more by looking at an example.

Error Code:

print("10 Divided by 2: ", 10\2)

Output:

print("10 Divided by 2: ", 10\2)
^
SyntaxError: unexpected character after line continuation character

SyntaxError: unexpected character after line continuation character

Explanation:

In the code written above, you can observe that the SyntaxError is raised. The code tries to divide 10 by 2 and print the result. But instead of using the division operator, that is the front slash “/”, the backslash “\” is used. So

Related Articles

Latest Articles