Python SyntaxError: EOL while scanning string literal

Cing Sian Dal
1 min readApr 9, 2020

--

It means you have to escape string.

For example

Instead of this:

text = "\a \b \c"
if text.startswith("\c")
return True

Use this:

text = "\a \b \c"
if text.startswith("\\c")
return True

Escape with slash.

--

--

Cing Sian Dal
Cing Sian Dal

Written by Cing Sian Dal

Don’t follow me. I wrote junks here. Follow me on Twitter instead.

No responses yet