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


Groups > comp.lang.python > #17526

Re: the slash & Windows paths

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <bahamutzero8825@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'escape': 0.04; 'cpython': 0.05; 'character,': 0.07; 'tab': 0.07; 'ugly': 0.07; 'python': 0.08; 'path.': 0.09; 'skip:\\ 10': 0.09; 'storing': 0.09; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; 'thunderbird': 0.16; 'wrote:': 0.18; 'subject:Windows': 0.18; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'interpreted': 0.23; 'literal': 0.23; 'modify': 0.25; 'otherwise,': 0.25; 'code': 0.25; 'windows': 0.26; 'function': 0.27; 'variable': 0.28; '(you': 0.28; 'pm,': 0.29; 'juan': 0.30; 'preceding': 0.30; "didn't": 0.31; 'pointing': 0.32; 'message- id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'rather': 0.33; 'to:addr:python-list': 0.34; 'it.': 0.34; 'file': 0.36; 'example,': 0.37; 'but': 0.37; 'received:192': 0.37; 'received:google.com': 0.37; 'problems': 0.37; 'could': 0.37; 'replace': 0.38; 'received:209.85': 0.38; 'getting': 0.38; 'characters': 0.39; 'being': 0.39; 'called': 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'received:192.168': 0.40; 'your': 0.61; 'subject: & ': 0.62; 'special': 0.68; '8bit%:46': 0.73; 'skip:\xe2 10': 0.74
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=FhJP/3r6iXU6cGBOtM89pefm4gMQtT9OmFGLEDh4CwI=; b=T6cEN/I4F2uKrDCq8zhZCFfqZEpp9CKnEEOo9yH+j+AOv8Sz+yNEOsL5OvptYkISw4 48mNQLNLVw3qWvVH8jpm80mcz2a0noOgfOqbNmdTA8znuWG5Dn0Tq9Kuvp62oeeZPflY fezLPYiOX4QTrnEMNDD/Q5qPDnEESZ8FTOVFw=
Date Mon, 19 Dec 2011 16:32:13 -0600
From Andrew Berg <bahamutzero8825@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0) Gecko/20110922 Thunderbird/7.0
MIME-Version 1.0
To "comp.lang.python" <python-list@python.org>
Subject Re: the slash & Windows paths
References <3CB1190388197146B35D522652EAB501016E4044BA@MESAMAIL01.acctcom.mesa>
In-Reply-To <3CB1190388197146B35D522652EAB501016E4044BA@MESAMAIL01.acctcom.mesa>
X-Enigmail-Version 1.3.3
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
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.3831.1324333943.27778.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1324333943 news.xs4all.nl 6930 [2001:888:2000:d::a6]:45046
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17526

Show key headers only | View raw


On 12/19/2011 4:02 PM, Juan Declet-Barreto wrote:
> I have a Windows-style path that I need to modify so Python functions
> can find it. For example, the path
> “C:\Projects\Population_Pyramids\charts\test.xls” is being interpreted
> as pointing to a file called “est.xls” since the “t” is being escaped by
> the preceding slash as a tab.
Whatever code is getting the path and storing it into a variable needs
to escape the path. Otherwise, you'll have to replace each
tab/newline/etc. with literal \t/\n/\r/etc., and that's ugly and could
lead to problems (you may have special characters you want to keep). The
reason your replace code didn't work is because the \t is a tab
character, not a literal "\t". The replace function doesn't see "\t",
but rather a tab.

-- 
CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 7.0

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


Thread

Re: the slash & Windows paths Andrew Berg <bahamutzero8825@gmail.com> - 2011-12-19 16:32 -0600

csiph-web