[Tutor] FW: wierd replace problem

James Mills prologic at shortcircuit.net.au
Tue Sep 14 12:09:42 CEST 2010


On Tue, Sep 14, 2010 at 5:28 PM, Roelof Wobben <rwobben at hotmail.com> wrote:
> Strip ('"'') does not work.
> Still this message : SyntaxError: EOL while scanning string literal
>
> So I think I go for the suggestion of Bob en develop a programm which deletes all the ' and " by scanning it character by character.

I seriously don't understand why you're having so much trouble with this
and why this thread has gotten as long as it has :/

Look here:

$ python
Python 2.6.5 (r265:79063, Jun 13 2010, 14:03:16)
[GCC 4.4.4 (CRUX)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> s = "foo\"bar'"
>>> s
'foo"bar\''
>>> s.replace("\"", "").replace("'", "")
'foobar'
>>>

Surely you can use the same approach ?

cheers
James

-- 
-- James Mills
--
-- "Problems are solved by method"


More information about the Tutor mailing list