[Tutor] wierd replace problem

Steven D'Aprano steve at pearwood.info
Tue Sep 14 14:29:47 CEST 2010


On Tue, 14 Sep 2010 03:28:46 am Alan Gauld wrote:
> "Roelof Wobben" <rwobben at hotmail.com> wrote
>
> > Now I want to get rid of the \\ so I do this : test2 = test.replace
> > ('\\', '')
> > And I get at the python prompt this answer : 'het is een wonder
> > TIS' So that's right.
>
> OK,. Thats replacing a double slash in the data

Er, surely not... I think you've confused backslashes and forward 
slashes. Or something. '\\' is a single backslash, not a double, 
because the first backslash is the escape character.

A double backslash can be written '\\\\'.



-- 
Steven D'Aprano


More information about the Tutor mailing list