Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in Python by (240 points)
Hey guys. Let's say I have a string a1="a really long string............", as soon as I post this, I get the error mentioned in the title.

How do I go about fixing this? Appreciate the help!

2 Answers

0 votes
by (300 points)

You need to put a double quote (") at the end of the line to achieve your goal. You can also use """ and get away with it.

Try this:
 

""" a very long string ...... 

....that can span multiple lines

"""

Let me know if that helps!

0 votes
by (106k points)
edited by

To get rid of the error EOL while scanning string literal you can include \ characters in the string. If you have any of these, "escape" them with \\ and it should work fine.

To know more about this you can have a look at the following video:-

If you are interested to learn Python from Industry experts, you can sign up for this Python Certification Course by Intellipaat.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.5k questions

29.9k answers

500 comments

99.1k users

Browse Categories

...