On Tue, 14 Sep 2010 05:38:18 pm Roelof Wobben wrote: > >> Strip ('"'') does not work. > >> Still this message : SyntaxError: EOL while scanning string > >> literal [...] > I understand what you mean but we're talking about a text-file which > will be read in a string. So I can't escape the quotes. As far as I > know I can't control how Python is reading a text-file with quotes.
The text file has nothing to do with this. The text file is fine. The error is in the strings that YOU type, not the text file. Strings must have MATCHING quotation marks: This is okay: "abcd" So is this: 'abcd' But this is not: "abcd' You need to *look carefully* at strings you type and make sure that the start and end quotes match. Likewise you can't insert the SAME quotation mark in a string unless you escape it first: This is okay: "'Hello,' he said." So is this: '"Goodbye," she replied.' But this is not: 'He said "I can't see you."' But this is okay: 'He said "I can\'t see you."' -- Steven D'Aprano _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor