In List Query -> None Case Sensitive?
ethan at stoneleaf.us
Fri Apr 1 00:05:45 CEST 2011
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)
> return result
> for filePath in FindMedia(path):
if iFile in media:
if iFile.upper() in media:
and keep media all upper-case.
More information about the Python-list