Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2303 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2011-04-01 08:51 +1100 |
| Last post | 2011-04-01 08:51 +1100 |
| 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.
Re: In List Query -> None Case Sensitive? Chris Angelico <rosuav@gmail.com> - 2011-04-01 08:51 +1100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2011-04-01 08:51 +1100 |
| Subject | Re: In List Query -> None Case Sensitive? |
| Message-ID | <mailman.45.1301608275.2990.python-list@python.org> |
On Fri, Apr 1, 2011 at 8:14 AM, Wehe, Marco <Marco.Wehe@bskyb.com> 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? > > 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=[f.upper() for f in media] Or you can equally use lower() instead of upper(). Chris Angelico
Back to top | Article view | comp.lang.python
csiph-web