469,904 Members | 2,261 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,904 developers. It's quick & easy.

"EOL while scanning single-quoted string", what is the meaning?

5
I am trying to write a long string into a txt file, the string includes some backslash, looks like:
'd:\#########\#######\####### d:\######\####\####\### d:\###\###\'
then I got a error saying 'EOL while scanning single-quoted string'. But it works when I just delete the last backslash or add one more backslash in the end.
Can someone tell me what is the meaning of this error, and how to handle this problem? Thanks.
Nov 2 '06 #1
2 10456
bvdet
2,851 Expert Mod 2GB
I am trying to write a long string into a txt file, the string includes some backslash, looks like:
'd:\#########\#######\####### d:\######\####\####\### d:\###\###\'
then I got a error saying 'EOL while scanning single-quoted string'. But it works when I just delete the last backslash or add one more backslash in the end.
Can someone tell me what is the meaning of this error, and how to handle this problem? Thanks.
Try this:
Expand|Select|Wrap|Line Numbers
  1. >>> s = 'd:\\#########\\#######\\####### d:\\######\\####\\####\\### d:\\###\\###\\'
  2. >>> print s
  3. d:\#########\#######\####### d:\######\####\####\### d:\###\###\
Nov 2 '06 #2
bartonc
6,596 Expert 4TB
I am trying to write a long string into a txt file, the string includes some backslash, looks like:
'd:\#########\#######\####### d:\######\####\####\### d:\###\###\'
then I got a error saying 'EOL while scanning single-quoted string'. But it works when I just delete the last backslash or add one more backslash in the end.
Can someone tell me what is the meaning of this error, and how to handle this problem? Thanks.
or use
r'd:\#########\#######\####### d:\######\####\####\### d:\###\###\'
for raw string which works for windows dirictory.
Nov 3 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Phil Powell | last post: by
68 posts views Thread by Marco Bubke | last post: by
3 posts views Thread by Martin Ink | last post: by
1 post views Thread by sarak13_2000 | last post: by
6 posts views Thread by Nirjhar Oberoi | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.