Case insensitive exists()?
Grant Edwards
invalid at invalid.invalid
Thu Jan 23 09:58:24 EST 2014
On 2014-01-23, Larry Martell <larry.martell at gmail.com> 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?
If you're on Unix, you could use os.popen() to run a find command
using -iname.
--
Grant Edwards grant.b.edwards Yow! I'm DESPONDENT ... I
at hope there's something
gmail.com DEEP-FRIED under this
miniature DOMED STADIUM ...
More information about the Python-list
mailing list