Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #91014
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail |
|---|---|
| From | Grant Edwards <invalid@invalid.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence |
| Date | Thu, 21 May 2015 16:31:51 +0000 (UTC) |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 40 |
| Message-ID | <mjl19n$etm$1@reader1.panix.com> (permalink) |
| References | <9d786d0b-0f25-4446-a730-ff1fe2f6b20d@googlegroups.com> <555d9233$0$12913$c3e8da3$5496439d@news.astraweb.com> <mjkp7j$p7k$1@reader1.panix.com> <mailman.200.1432218440.17265.python-list@python.org> |
| NNTP-Posting-Host | 67-130-15-94.dia.static.qwest.net |
| X-Trace | reader1.panix.com 1432225911 15286 67.130.15.94 (21 May 2015 16:31:51 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Thu, 21 May 2015 16:31:51 +0000 (UTC) |
| User-Agent | slrn/1.0.1 (Linux) |
| Xref | csiph.com comp.lang.python:91014 |
Show key headers only | View raw
On 2015-05-21, Chris Angelico <rosuav@gmail.com> wrote:
> On Fri, May 22, 2015 at 12:14 AM, Grant Edwards <invalid@invalid.invalid> wrote:
>> On 2015-05-21, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
>>
>>> import glob
>>> print(glob.glob("c:/abc/def/ghjmain/features/XYZ/*<filename>"))
>>>
>>> Don't use backslashes \ as they have special meaning to Python. Use forward
>>> slashes and let Python convert them as needed.
>>
>> Interesting. I've never heard about this.
>>
>> When will Python convert them?
>
> Actually, it won't ever bother to convert them.
OK, so this isn't some new feature I hadn't heard about due to my
spending most of my time with 2.7. :)
> The Windows file system APIs are quite happy to work with forward
> slashes;
Yep, I knew that -- I have always use forward slashes on Windows (and
DOS before that) when dealing with the file system.
> it's only command-line tools (which conventionally use forward
> slashes to introduce options), and not all of them, which require
> backslashes.
Yup, I was wondering if that was where Python (or its stdlib) would
convert them (which would have surprised me). Back in the day, you
could change the 'option switch' character from '/' to whatever you
wanted (and as an old Unix guy, I always set it to '-'). Then you
could even use forward slashes on the command line (mostly). But, I
don't think Windows has support that for yonks.
--
Grant Edwards grant.b.edwards Yow! Please come home with
at me ... I have Tylenol!!
gmail.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence chaotic.sid@gmail.com - 2015-05-20 22:34 -0700
Re: Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-21 18:07 +1000
Re: Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence Peter Otten <__peter__@web.de> - 2015-05-21 10:54 +0200
Re: Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence Tim Golden <mail@timgolden.me.uk> - 2015-05-21 10:06 +0100
Re: Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence Grant Edwards <invalid@invalid.invalid> - 2015-05-21 14:14 +0000
Re: Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence Chris Angelico <rosuav@gmail.com> - 2015-05-22 00:27 +1000
Re: Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence Grant Edwards <invalid@invalid.invalid> - 2015-05-21 16:31 +0000
Re: Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence MRAB <python@mrabarnett.plus.com> - 2015-05-21 17:54 +0100
Re: Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence Tim Golden <mail@timgolden.me.uk> - 2015-05-21 15:32 +0100
csiph-web