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


Groups > comp.lang.python > #91010

Re: Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'apis': 0.07; 'subject:file': 0.07; '22,': 0.09; 'cc:addr:python-list': 0.10; 'python': 0.11; 'python.': 0.11; 'explicitly': 0.15; 'output': 0.15; 'backslashes': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'objections': 0.16; 'options),': 0.16; 'slashes': 0.16; 'subject: \n ': 0.16; 'subject:folder': 0.16; 'subject:sub': 0.16; 'uncommon': 0.16; 'wrote:': 0.16; 'instance,': 0.18; 'windows': 0.20; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'am,': 0.23; 'code,': 0.23; '2015': 0.23; 'needed.': 0.23; "i've": 0.24; 'import': 0.24; 'header:In- Reply-To:1': 0.24; 'converting': 0.27; 'mix': 0.27; 'message- id:@mail.gmail.com': 0.28; 'this.': 0.28; 'subject:/': 0.29; 'command-line': 0.29; 'them?': 0.29; 'convert': 0.29; '(which': 0.29; 'fri,': 0.31; "i'd": 0.31; "d'aprano": 0.33; 'steven': 0.33; 'file': 0.34; 'received:google.com': 0.34; 'path': 0.35; 'something': 0.35; 'but': 0.36; 'heard': 0.36; 'quite': 0.37; 'subject:: ': 0.37; "won't": 0.38; 'subject:-': 0.39; 'your': 0.60; 'back': 0.61; 'even': 0.61; 'forward': 0.65; 'special': 0.72; 'introduce': 0.78; '1990s,': 0.84; 'actually,': 0.84; 'chrisa': 0.84; 'to:none': 0.90; 'edwards': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=OUyhKDucnyrNBBKwwc48DMEcJU8sW9Ff64InLgXCPuY=; b=w0jgU1I+9FaPOqSJ9dh2gUTTIQXHNd6JMoVy57pLrEN4lEmmGY9MOxYCeb4+sDNgKd Yi2maTRZ8tW64uBRUflro0qXJXJBojsobYZK+Nbq1idP5lFavMbJFkoU+M7vN7EMuLCc yXcMBsf+9iU/oXK71RKtkgQqwjN10ldmms16FhLiG8UawVhkXsrglb1O76OnM5UzrffD ++xc0AQ+BKRauDDKCRdbEmNSGMVxssQMKqVfDUeDqoFapaeO7J9RyvJ0M3a/Ihi3LqzL dViOGdXQ0NkMBq86YO9A4L7oMy1+p6+kkDjcgjtOtJXmv+AGotRZZr5qhVANmoUI2MYE LjHg==
MIME-Version 1.0
X-Received by 10.43.0.67 with SMTP id nl3mr3447975icb.59.1432218437327; Thu, 21 May 2015 07:27:17 -0700 (PDT)
In-Reply-To <mjkp7j$p7k$1@reader1.panix.com>
References <9d786d0b-0f25-4446-a730-ff1fe2f6b20d@googlegroups.com> <555d9233$0$12913$c3e8da3$5496439d@news.astraweb.com> <mjkp7j$p7k$1@reader1.panix.com>
Date Fri, 22 May 2015 00:27:17 +1000
Subject Re: Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.200.1432218440.17265.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1432218440 news.xs4all.nl 2833 [2001:888:2000:d::a6]:37408
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:91010

Show key headers only | View raw


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. The Windows file
system APIs are quite happy to work with forward slashes; it's only
command-line tools (which conventionally use forward slashes to
introduce options), and not all of them, which require backslashes.

You may want to consider explicitly converting them in your own code,
prior to showing a path to a human; but even back in the 1990s, it
wasn't uncommon for cross-platform programs to mix and match - for
instance, if you unzip something into C:\Foo\Bar, you'd get output
like "Inflating C:\Foo\Bar/usr/lib/whatever". I'd have no objections
to a program using forward slashes all the way.

ChrisA

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


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