Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed1a.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.024 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'string': 0.09; 'os.path': 0.09; 'for,': 0.16; 'subject:Case': 0.16; 'subject:exists': 0.16; 'subject:insensitive': 0.16; 'there?': 0.16; 'to:name:python- list@python.org': 0.22; 'this?': 0.23; 'string,': 0.24; 'compare': 0.26; 'switch': 0.26; 'message-id:@mail.gmail.com': 0.30; 'existence': 0.31; 'anyone': 0.31; 'file': 0.32; 'but': 0.35; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'files': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'name': 0.63; 'different': 0.65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=K+elAWRUpny0VWipsHpJncHbPkArhA1lQqQemQSojTs=; b=WnQFDYu8Ns9TQrxV2aK/+YSTSC3f9O05vT0g8mkTn4v/S1JWr+Oy0Q7TDjyz5gnnhe 42lvlIsmkZyRsdwkREQylH/1yKKWyEFayEKNCak6uxmoFjcODYdoWQ0x2RzsXYiwUaHA 6+w7hcgmX9VxvL/vRDu272tMDEvpRos27+0QZu36zi6gvSaNxYFGNybIvc2e6PV0OpwL s9hRqj3drP/x35WsK/dLPPfWPrSXffCLdoYCfpUkhn9BwbqFi0v7m+TfYt3XF1pp54Y3 gkhNilDaG3+ix2VVvPMWMm3ZreC/nHQyHOzkOj35vFHY16iuqpyES39CYkaVI5yGyi1p azbw== MIME-Version: 1.0 X-Received: by 10.58.187.98 with SMTP id fr2mr32066vec.38.1390438699339; Wed, 22 Jan 2014 16:58:19 -0800 (PST) Date: Wed, 22 Jan 2014 17:58:19 -0700 Subject: Case insensitive exists()? From: Larry Martell To: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 7 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1390438708 news.xs4all.nl 2897 [2001:888:2000:d::a6]:45286 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:64544 I have the need to check for a files existence against a string, but I need to do case-insensitively. I cannot efficiently get the name of every file in the dir and compare each with my string using lower(), as I have 100's of strings to check for, each in a different dir, and each dir can have 100's of files in it. Does anyone know of an efficient way to do this? There's no switch for os.path that makes exists() check case-insensitively is there?