Skip to main content

Posts

Showing posts with the label The Crazy Programmer Solve SyntaxError: EOL while scanning string literal in Python Solve SyntaxError: EOL while scanning string literal in Python The Crazy Programmer

Solve SyntaxError: EOL while scanning string literal in Python Pratik Sah The Crazy Programmer

Hello friends, In my last post I’ve discussed the common problem Python Programmers face i.e. unexpected EOF while parsing and in today’s post, I’ll be discussing EOL while scanning string literal. But do you exactly know what is this error all about and how we can remove it from our python code? So, what exactly an EOL is? EOL stands for  End Of Line . This means we have now come to the end of our line and the error related to this is shown below with example code. def printName(): return "This is a test basestring printName() Now, after running this piece of code, I get an error something similar to this. File "main.py", line 2 return "This is a test basestring SyntaxError: EOL while scanning string literal ...Program finished with exit code 1 Press ENTER to exit the console Now the above code contains one error and the error is that the return in the printName( ) function in the above code is not closed properly. We can see that it doesn’