Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'subject:file': 0.07; 'accepts': 0.09; 'python': 0.11; 'python.': 0.11; 'backslashes': 0.16; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'message-id:@timgolden.me.uk': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'slashes': 0.16; 'subject: \n ': 0.16; 'subject:folder': 0.16; 'subject:sub': 0.16; 'tjg': 0.16; 'wrote:': 0.16; 'passes': 0.18; 'windows': 0.20; 'needed.': 0.23; 'passing': 0.23; "i've": 0.24; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'this.': 0.28; 'subject:/': 0.29; '(although': 0.29; 'cases.': 0.29; 'them?': 0.29; 'unchanged': 0.29; 'convert': 0.29; 'function': 0.30; 'call,': 0.33; "d'aprano": 0.33; 'received:192.168.100': 0.33; 'steven': 0.33; 'to:addr:python- list': 0.35; 'along': 0.35; 'path': 0.35; 'but': 0.36; 'heard': 0.36; 'modules': 0.36; 'subject:: ': 0.37; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'subject:-': 0.39; 'forward': 0.65; 'from:addr:mail': 0.70; 'special': 0.72; 'edwards': 0.91 Date: Thu, 21 May 2015 15:32:49 +0100 From: Tim Golden User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Find if a file existing within 1000s of folder/sub-folder - each file has a unique presence References: <9d786d0b-0f25-4446-a730-ff1fe2f6b20d@googlegroups.com> <555d9233$0$12913$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1432218774 news.xs4all.nl 2840 [2001:888:2000:d::a6]:40275 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:91011 On 21/05/2015 15:14, Grant Edwards wrote: > On 2015-05-21, Steven D'Aprano wrote: > >> import glob >> print(glob.glob("c:/abc/def/ghjmain/features/XYZ/*")) >> >> 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? > It doesn't: Python passes them on unchanged and Windows accepts them in all but a few cases. (Although if any stdlib function were to call, eg, os.path.abspath on a path before passing it along to Windows then one effect is that the path is "normalised", ending up with backslashes. So perhaps that does happen in modules like shutil. Not sure). TJG