Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17526
| Date | 2011-12-19 16:32 -0600 |
|---|---|
| From | Andrew Berg <bahamutzero8825@gmail.com> |
| Subject | Re: the slash & Windows paths |
| References | <3CB1190388197146B35D522652EAB501016E4044BA@MESAMAIL01.acctcom.mesa> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3831.1324333943.27778.python-list@python.org> (permalink) |
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
Re: the slash & Windows paths Andrew Berg <bahamutzero8825@gmail.com> - 2011-12-19 16:32 -0600
csiph-web