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


Groups > comp.lang.python > #64565 > unrolled thread

Re: Case insensitive exists()?

Started byLarry Martell <larry.martell@gmail.com>
First post2014-01-22 21:25 -0700
Last post2014-01-22 21:25 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Case insensitive exists()? Larry Martell <larry.martell@gmail.com> - 2014-01-22 21:25 -0700

#64565 — Re: Case insensitive exists()?

FromLarry Martell <larry.martell@gmail.com>
Date2014-01-22 21:25 -0700
SubjectRe: Case insensitive exists()?
Message-ID<mailman.5868.1390451140.18130.python-list@python.org>
On Wed, Jan 22, 2014 at 6:27 PM, MRAB <python@mrabarnett.plus.com> wrote:
> On 2014-01-23 00:58, Larry Martell wrote:
>>
>> 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?
>>
> You don't say which OS. Filenames in Windows, for example, are already
> case-insensitive.

Linux.

> Try writing it the simplest and cleanest way, without thinking about
> efficiency. If you discover that it really is too slow (you can always
> try a smaller test case initially), then you can think about how to
> speed it up.

Yes, that's my plan.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web