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


Groups > comp.lang.python > #17955

Re: Backslash Escapes

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; 'python': 0.08; 'default.': 0.09; 'parsing': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'files.': 0.09; 'backslashes': 0.16; 'escapes': 0.16; 'this:': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'written': 0.20; 'input': 0.22; 'header:In-Reply-To:1': 0.22; "shouldn't": 0.23; 'shell': 0.24; 'all,': 0.28; 'pm,': 0.29; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'there': 0.33; 'to:addr:python-list': 0.34; 'elegant': 0.34; 'unless': 0.35; 'file': 0.36; 'received:au': 0.36; 'uses': 0.36; 'received:org': 0.38; 'goes': 0.39; 'to:addr:python.org': 0.40; 'your': 0.61; 'ever': 0.65; 'received:110': 0.95
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Lie Ryan <lie.1296@gmail.com>
Subject Re: Backslash Escapes
Date Mon, 26 Dec 2011 20:36:39 +1100
References <CAAfDyksFRAmzm1XhQFwSgAD-+ZVxYVuiqMfSMigN3RRkJdFkUw@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 110-175-240-90.static.tpgi.com.au
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0
In-Reply-To <CAAfDyksFRAmzm1XhQFwSgAD-+ZVxYVuiqMfSMigN3RRkJdFkUw@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4100.1324892219.27778.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1324892219 news.xs4all.nl 6866 [2001:888:2000:d::a6]:38497
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17955

Show key headers only | View raw


On 12/26/2011 12:04 PM, Felipe O wrote:
> Hi all,
> Whenever I take any input (raw_input, of course!) or I read from a
> file, etc., any backslashes get escaped automatically.

Python never escapes backslashes when reading from raw_input or files. 
Python only ever escapes backslashes when displaying data on the 
interactive shell since the interactive shell uses __repr__ by default.

> Is there any
> elegant way of parsing the backslashes as though they were written in
> a python string. The best I have so far right now goes like this:

You shouldn't ever need to unless your file are backslash-escaped.

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


Thread

Re: Backslash Escapes Lie Ryan <lie.1296@gmail.com> - 2011-12-26 20:36 +1100

csiph-web