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


Groups > comp.lang.python > #17955

Re: Backslash Escapes

From Lie Ryan <lie.1296@gmail.com>
Subject Re: Backslash Escapes
Date 2011-12-26 20:36 +1100
References <CAAfDyksFRAmzm1XhQFwSgAD-+ZVxYVuiqMfSMigN3RRkJdFkUw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4100.1324892219.27778.python-list@python.org> (permalink)

Show all headers | 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