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


Groups > comp.lang.python > #2304

Re: In List Query -> None Case Sensitive?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
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; 'files:': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'match.': 0.09; 'message- id:@stoneleaf.us': 0.09; 'received:74.54.199': 0.09; 'received:74.54.199.50': 0.09; 'received:gator410.hostgator.com': 0.09; 'subject:None': 0.09; '~ethan~': 0.09; 'def': 0.13; 'wrote:': 0.14; 'dirs,': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'root,': 0.16; 'subject:Query': 0.16; 'to:name:python- list@python.org': 0.16; 'subject:List': 0.20; 'header:In-Reply- To:1': 0.22; "doesn't": 0.28; 'subject:?': 0.29; 'list': 0.30; 'marco': 0.31; 'to:addr:python-list': 0.32; 'skip:" 10': 0.34; 'regular': 0.34; 'change': 0.34; 'there': 0.35; 'header:User- Agent:1': 0.35; 'doing': 0.36; 'case': 0.37; 'but': 0.38; 'skip:" 20': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'received:74.54': 0.60; 'media': 0.61; 'full': 0.62; 'received:hostgator.com': 0.64; 'received:websitewelcome.com': 0.71; 'smooth': 0.84; 'subject:Case': 0.84; 'received:69.93': 0.91
Date Thu, 31 Mar 2011 15:05:45 -0700
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version 1.0
To "python-list@python.org" <python-list@python.org>
Subject Re: In List Query -> None Case Sensitive?
References <BB7D4CEE02C38D499DF7CA5B8D08578721DDDF7E@AMSXMBX01.bskyb.com>
In-Reply-To <BB7D4CEE02C38D499DF7CA5B8D08578721DDDF7E@AMSXMBX01.bskyb.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - gator410.hostgator.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - stoneleaf.us
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:2889
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.47.1301608486.2990.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 82.94.164.166
X-Trace 1301608486 news.xs4all.nl 81482 [::ffff:82.94.164.166]:53190
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:2304

Show key headers only | View raw


Wehe, Marco wrote:
> I am doing a search through a list of files but the text the casing 
> doesn't match. My list is all upper case but the real files are all 
> different. Is there a smooth way of searching through the list without 
> going full on regular expressions?
> 
> path = "V:\\Jinsy\\incoming\\assets"
> media=["LIHOU ISLAND.MOV", "MVI_1449.MOV"]
> def FindMedia(path):
>     result = []
>     for root, dirs, files in os.walk(path):
>         for iFile in files:
>             if iFile in media:
>                 filePath = os.path.join(root, iFile)
>                 result.append(filePath)
>     return result
> for filePath in FindMedia(path):
>     log(filePath)


Change

if iFile in media:

to

if iFile.upper() in media:

and keep media all upper-case.

~Ethan~

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


Thread

Re: In List Query -> None Case Sensitive? Ethan Furman <ethan@stoneleaf.us> - 2011-03-31 15:05 -0700

csiph-web