python Syntax Error EOL while scanning string literal

0 votes
I have the above-mentioned error in s1="some very long string............"

What is wrong here?
Feb 4 in Python by Nandini
• 5,480 points
149 views

1 answer to this question.

0 votes

There are many ways to deal with this:

  1. Use r before the string to avoid any errors, this will parse the string without giving errors.

For example:

 s= r”some very long string …”
  1. Using escape characters \ to use it in strings add one more \. This means \\ without and space in between

  2. Can use triple quotation marks, be careful to use only three quotation marks.
       " " " a very long string ......            
     ....multiple lines
            " " "

Hope this helps.

answered Feb 5 by Dev
• 6,000 points

Related Questions In Python

+2 votes
2 answers

Error while printing hello world in python.

You must be trying this command in ...READ MORE

answered Mar 31, 2018 in Python by GandalfDwhite
• 1,320 points
2,238 views
+1 vote
10 answers

How to fix this? ValueError: invalid literal for int() with base 10 error in Python

Just for the record: >>> int('55063.000000') Traceback (most recent ...READ MORE

answered Aug 17, 2020 in Python by pakainfo
• 200 points
360,754 views
0 votes
2 answers

Python UnboundLocalError error while executing script

Inside your function when you say word=word+1, ...READ MORE

answered May 22, 2020 in Python by Ibrahim Nezar
• 140 points
646 views
+1 vote
2 answers

Python error "Python: can't assign to literal"

The way you're assigning variables is not ...READ MORE

answered Jun 17, 2019 in Python by Priya
12,589 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,827 views
0 votes
1 answer
0 votes
2 answers

What's the difference between %s and %d in Python string formatting?

The reason is that they are using ...READ MORE

answered Feb 8 in Python by Rahul
• 8,980 points
32 views
0 votes
1 answer

Converting integer to string in Python

In order to convert an object to string ...READ MORE

answered Feb 11 in Python by Dev
• 6,000 points
23 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP