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!news2.euro.net!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.062 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'match.': 0.09; 'subject:None': 0.09; 'am,': 0.14; 'wrote:': 0.14; 'subject:Query': 0.16; '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0': 0.16; 'subject:List': 0.20; 'header:In-Reply-To:1': 0.22; 'received:209.85.214.174': 0.23; 'received:mail- iw0-f174.google.com': 0.23; 'easiest': 0.25; 'instead': 0.26; 'chris': 0.27; 'message-id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'subject:?': 0.29; 'fri,': 0.29; 'list': 0.30; 'equally': 0.31; 'marco': 0.31; 'to:addr:python-list': 0.32; 'regular': 0.34; 'there': 0.35; 'force': 0.35; 'doing': 0.36; 'case': 0.37; 'received:209.85': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'files': 0.38; 'received:209.85.214': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; "it's": 0.40; 'header:Received:5': 0.40; '2011': 0.62; 'full': 0.62; 'media]': 0.84; 'smooth': 0.84; 'subject:Case': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=5t9qOa9XwHZ1XG7/FoDTz/gtYZZcFTJYGlecCWZsE0M=; b=lRUSkOrh8xBcAAzhuZ54YgmnQwsoJhej62GZLk6mIKU5oEes/TUyu6cn9WbdN/QeyY XhS2LcbXzsRxkym5DP2fWctgbnokMvWTx9lyWyAM8mOC6hCwUPsi15sIoesuyNTE3P6b 2sqcjmFEtPrAC1KPYsjOEXMvOik+zWHLx4NwE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=r/bR6ItUww3UaX+BFkCOBJilgsbaaZRZlUHnDy+fpypYOgy1tVi/9TC6TJlFBFrLVy R5XlrMYH/KdzGAxkkIb/f8J2/v+zYOnUv3WEIquB8AJDmeBIn+8xEeDcaRfVPHNmsDZU e9198vw3PS0LpfFLV3WLP8Sl3lO/uXrz3FONs= MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 1 Apr 2011 08:51:12 +1100 Subject: Re: In List Query -> None Case Sensitive? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 23 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1301608276 news.xs4all.nl 81482 [::ffff:82.94.164.166]:54326 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2303 On Fri, Apr 1, 2011 at 8:14 AM, 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. I= s there a smooth way of searching through the list without going full on re= gular expressions? > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if iFile in media: If you know they're *all* uppercase, the easiest way is to replace this line with: if iFile.upper() in media: It's not case insensitive per se. For true case insensitivity, force media[] to be all-uppercase too: media=3D[f.upper() for f in media] Or you can equally use lower() instead of upper(). Chris Angelico