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


Groups > comp.lang.python > #17526 > unrolled thread

Re: the slash & Windows paths

Started byAndrew Berg <bahamutzero8825@gmail.com>
First post2011-12-19 16:32 -0600
Last post2011-12-19 16:32 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#17526 — Re: the slash & Windows paths

FromAndrew Berg <bahamutzero8825@gmail.com>
Date2011-12-19 16:32 -0600
SubjectRe: the slash & Windows paths
Message-ID<mailman.3831.1324333943.27778.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web