Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #61263

Re: Is It Bug?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <iurisilvio@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'skip:\\ 20': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; "'\\\\'": 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'working.': 0.19; '>>>': 0.22; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; '&gt;&gt;&gt;': 0.24; 'interpret': 0.24; 'replace': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'url:python': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'method': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'so,': 0.37; 'pm,': 0.38; 'url:mail': 0.40; 'to:addr:gmail.com': 0.65; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=851AfkjLVt9+7x2hT31C1yo8g5802rmzWZxaBddu0iI=; b=IdleFdeCKcUhKgr3xy4JG9Yli4bodFoQzr3fCg96D8qfmMiZiiLN5MJuQPjRFqwfRN WcGHq+A1Z+Gwu+YKfNR3Wj4X+KevJotDd1+ffkveAw1OanzJJOKHdtlJUtfrONFchSqo T2sm6sJz9G/NZ3pImRNF1m0bGSWaas02/i1qXgirVRq1sGURdPqErltwjh92PChSIuy7 GUk6MamcRPZxj6tv2DpfBV8c/LlMdzwJPhtLhSGNaZT1hutk4JMDWHnMdQoBKDrmIGxS OAqAqFDNwogpKkZVmqEd8Aiwe8fQTu6N0qPMwZdGEUsiS6LnnTQpeGS5oYFFjG+xRKsd KiyA==
X-Received by 10.194.9.100 with SMTP id y4mr9479165wja.22.1386464673786; Sat, 07 Dec 2013 17:04:33 -0800 (PST)
MIME-Version 1.0
In-Reply-To <5865401e-aef8-4dd2-927c-52d2b7ca3ed8@googlegroups.com>
References <5865401e-aef8-4dd2-927c-52d2b7ca3ed8@googlegroups.com>
From Iuri <iurisilvio@gmail.com>
Date Sat, 7 Dec 2013 23:04:13 -0200
Subject Re: Is It Bug?
To Mahan Marwat <mahanmarwat@gmail.com>
Content-Type multipart/alternative; boundary=047d7b5d58a25ff43104ecfb7690
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3712.1386464680.18130.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386464680 news.xs4all.nl 2970 [2001:888:2000:d::a6]:49731
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61263

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

This way, it will replace '\' with '\', so nothing change.

>>> 'Hello, \\\\World'.replace('\\\\', '\\')
'Hello, \\World'
>>> print 'Hello, \\\\World'.replace('\\\\', '\\')
Hello, \World


On Sat, Dec 7, 2013 at 10:58 PM, Mahan Marwat <mahanmarwat@gmail.com> wrote:

> Why this is not working.
>
> >>> 'Hello, \\\\World'.replace('\\', '\\')
>
> To me, Python will interpret '\\\\' to '\\'. And the replace method will
> replace '\\' with '\'. So, the result will be 'Hello, \World'. But it's
> give me 'Hello, \\\\World'.
>
> The result I want form the code is 'Hello, \World'.
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Is It Bug? Mahan Marwat <mahanmarwat@gmail.com> - 2013-12-07 16:58 -0800
  Re: Is It Bug? Iuri <iurisilvio@gmail.com> - 2013-12-07 23:04 -0200
  Re: Is It Bug? rusi <rustompmody@gmail.com> - 2013-12-07 21:48 -0800
  Re: Is It Bug? Joshua Gardner <mellowcellofellow@gmail.com> - 2013-12-07 23:39 -0700

csiph-web