Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2320
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| 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; 'desired.': 0.07; 'variant': 0.07; 'alphabet': 0.09; 'files:': 0.09; 'from:addr:python': 0.09; 'match.': 0.09; 'subject:None': 0.09; 'def': 0.13; 'wrote:': 0.14; 'dirs,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'furman': 0.16; 'lowercase': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'reply-to:addr :python-list': 0.16; 'root,': 0.16; 'splits': 0.16; 'subject:Query': 0.16; 'uppercase': 0.16; 'converting': 0.16; 'subject:List': 0.20; 'header:In-Reply-To:1': 0.22; 'received:84': 0.25; "doesn't": 0.28; 'subject:?': 0.29; 'list': 0.30; 'marco': 0.31; 'to:addr:python-list': 0.32; 'example,': 0.33; 'using': 0.34; 'skip:" 10': 0.34; 'regular': 0.34; 'change': 0.34; 'there': 0.35; 'header:User-Agent:1': 0.35; 'reply-to:addr:python.org': 0.35; 'doing': 0.36; 'two': 0.37; 'case': 0.37; 'but': 0.38; 'skip:" 20': 0.38; 'files': 0.38; 'problems,': 0.39; 'to:addr:python.org': 0.39; 'media': 0.61; 'full': 0.62; 'reply- to:no real name:2**0': 0.72; 'header:Reply-To:1': 0.72; 'namely': 0.84; 'smooth': 0.84; 'subject:Case': 0.84; 'letters,': 0.91; 'latin': 0.93 |
| X-IronPort-Anti-Spam-Filtered | true |
| X-IronPort-Anti-Spam-Result | AnQIAGUYlU1UXebj/2dsb2JhbACER5QUjH93r02QfIEog0x3BJBm |
| Date | Fri, 01 Apr 2011 01:13:50 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: In List Query -> None Case Sensitive? |
| References | <BB7D4CEE02C38D499DF7CA5B8D08578721DDDF7E@AMSXMBX01.bskyb.com> <4D94FAB9.8020402@stoneleaf.us> |
| In-Reply-To | <4D94FAB9.8020402@stoneleaf.us> |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | python-list@python.org |
| 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.56.1301616901.2990.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1301616901 news.xs4all.nl 81479 [::ffff:82.94.164.166]:43628 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:2320 |
Show key headers only | View raw
On 31/03/2011 23:05, Ethan Furman wrote: > 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. > <aside> Converting to uppercase or lowercase doesn't always work as desired. For example, when using Turkish you can have problems, because the Turkish variant of the Latin alphabet splits i/I into two different letters, namely dotted "i" (uppercase is "İ" or "\u0130") and dotless "I" (lowercase is "ı" or "\u0131"). </aside>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: In List Query -> None Case Sensitive? MRAB <python@mrabarnett.plus.com> - 2011-04-01 01:13 +0100
csiph-web