In List Query -> None Case Sensitive?

Wehe, Marco Marco.Wehe at bskyb.com
Thu Mar 31 17:14:45 EDT 2011


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 at bskyb.com<mailto:smarco.wehe at 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110331/f5dc8d31/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 1181 bytes
Desc: image001.jpg
URL: <http://mail.python.org/pipermail/python-list/attachments/20110331/f5dc8d31/attachment.jpg>


More information about the Python-list mailing list