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


Groups > comp.lang.python > #2302 > unrolled thread

In List Query -> None Case Sensitive?

Started by"Wehe, Marco" <Marco.Wehe@bskyb.com>
First post2011-03-31 21:14 +0000
Last post2011-04-01 12:49 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  In List Query -> None Case Sensitive? "Wehe, Marco" <Marco.Wehe@bskyb.com> - 2011-03-31 21:14 +0000
    Re: In List Query -> None Case Sensitive? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-03-31 23:42 +0000
      Re: In List Query -> None Case Sensitive? Chris Angelico <rosuav@gmail.com> - 2011-04-01 11:01 +1100
        Re: In List Query -> None Case Sensitive? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-01 12:49 +0000

#2302 — In List Query -> None Case Sensitive?

From"Wehe, Marco" <Marco.Wehe@bskyb.com>
Date2011-03-31 21:14 +0000
SubjectIn List Query -> None Case Sensitive?
Message-ID<mailman.44.1301607001.2990.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

Hi,

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)



This is the real file name that I can't find:
Lihou Island.mov

Thanks a lot,
Marco
[sky]
Marco Wehe
Visual Effects TD
VFX/3D
BSkyB, Sky 2, Grant Way, Isleworth, Middlesex TW7 5QD
t: +44 (0) 20 7805 8035
f: +44 (0) 20 7805 6577
e: marco.wehe@bskyb.com<mailto:smarco.wehe@bskyb.com>



Information in this email including any attachments may be privileged, confidential and is intended exclusively for the addressee. The views expressed may not be official policy, but the personal views of the originator. If you have received it in error, please notify the sender by return e-mail and delete it from your system. You should not reproduce, distribute, store, retransmit, use or disclose its contents to anyone. Please note we reserve the right to monitor all e-mail communication through our internal and external networks. SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and are used under licence. British Sky Broadcasting Limited (Registration No. 2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited (Registration No. 2340150) are direct or indirect subsidiaries of British Sky Broadcasting Group plc (Registration No. 2247735). All of the companies mentioned in this paragraph are incorporated in England and Wales and share the same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

[toc] | [next] | [standalone]


#2315

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2011-03-31 23:42 +0000
Message-ID<4d951179$0$29992$c3e8da3$5496439d@news.astraweb.com>
In reply to#2302
On Thu, 31 Mar 2011 21:14:45 +0000, Wehe, Marco wrote:
[...]

Hi Marco, and welcome.

Others have already answered your question, but please don't post HTML 
formatted messages (so-called "rich text") to this mailing list. It is 
mirrored to a newsgroup, comp.lang.python, and many people read it via 
that. To many of those people your message will be entirely blocked due 
to the use of HTML code, and for many of the remaining, they will see 
this:

> <html xmlns:v="urn:schemas-microsoft-com:vml"
> xmlns:o="urn:schemas-microsoft-com:office:office"
> xmlns:w="urn:schemas-microsoft-com:office:word"
> xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
> xmlns="http://www.w3.org/TR/REC-html40"
> xmlns:ns1="urn:schemas-microsoft-com:office:smarttags"> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
> <meta name="ProgId" content="Word.Document"> <meta name="Generator"
> content="Microsoft Word 11"> <meta name="Originator" content="Microsoft
> Word 11">

which then goes on in that style for another NINE PAGES.

(Oh, and I don't want to come across as elitist, but if you're using the 
two-ton wrecking ball of Microsoft Word to crack the tiny peanut of 
writing emails, you will have *zero* tech credibility in programming 
communities. Harsh but true. Sorry Marco, but mastery of tools is 
important to programmers, and a tool that generates as crufty HTML as 
Word does will unfortunately reflect badly on the person using the tool.)



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#2317

FromChris Angelico <rosuav@gmail.com>
Date2011-04-01 11:01 +1100
Message-ID<mailman.54.1301616071.2990.python-list@python.org>
In reply to#2315
On Fri, Apr 1, 2011 at 10:42 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> (Oh, and I don't want to come across as elitist, but if you're using the
> two-ton wrecking ball of Microsoft Word to crack the tiny peanut of
> writing emails, you will have *zero* tech credibility in programming
> communities. Harsh but true. Sorry Marco, but mastery of tools is
> important to programmers, and a tool that generates as crufty HTML as
> Word does will unfortunately reflect badly on the person using the tool.)

There are the mistakes (nearly) everyone makes when new. I think HTML
email might be one of them.

The difference between a good programmer and a mediocre one is that
the good programmer has already made a lot of mistakes, and has
learned from them. The difference between an excellent programmer and
a good one is that the excellent one is familiar with a huge number of
tools, and knows which one is best for which situation. A two-ton
wrecking ball is not the best tool for cracking peanuts; Microsoft
Word is not the best tool for... well, anything, probably. My boss at
work laughs sometimes at the weird variety of tools I crack out in
response to various problems - today it's awk, tomorrow sed, the next
day some two-minute script in Python, Pike, bash, PHP, or REXX....
ever noticed how beautiful chaos can be? :)

Chris Angelico

[toc] | [prev] | [next] | [standalone]


#2347

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2011-04-01 12:49 +0000
Message-ID<4d95c9cd$0$29992$c3e8da3$5496439d@news.astraweb.com>
In reply to#2317
On Fri, 01 Apr 2011 11:01:07 +1100, Chris Angelico wrote:

> Microsoft Word is not the best
> tool for... well, anything, probably.

Since I raised the issue of MS Word, I should throw in a defense for it.

After a break from using Word for about five years, when I exclusively 
used OpenOffice for word processing, I had an work project where I had to 
use Word extensively. I wouldn't say that Word is perfect by any means, 
but its usability is *much* more polished than OpenOffice Writer. I find 
myself cursing OpenOffice Writer for getting the little things wrong *all 
the time*, while Word gets them right nearly always, and only 
occasionally wrong. Word also has a deepness and richness of power that 
I've only just begun to use, but is quite simple once you know where to 
look.

I don't know if Word is "the best" word processor, but it's surely the 
champion to beat. (Even if it does generate masses of bad HTML.)

On the other hand, Excel's usability is a dog. Give me OpenOffice's 
spreadsheet any day.

(In fairness, I haven't used OpenOffice 3 much, so perhaps it is better.)

Anyway, these things are quite sensitive to tiny improvements and 
breakages in the user-interface between versions and platforms, so YMMV.


-- 
Steven

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web