def case_insensitive_file_search(directory, pattern):
    """
    Looks for file with pattern with case insensitive search
    """
    try:
        return os.path.join(
            directory,
            [filename for filename in os.listdir(directory)
             if re.search(pattern, filename, re.IGNORECASE)][0])
    except IndexError:
        print("{0} not found".format(pattern))
        raise
def case_insensitive_file_search ( directory , pattern ) : try : return os . path . join ( directory , [ filename for filename in os . listdir ( directory ) if re . search ( pattern , filename , re . IGNORECASE ) ] [ 0 ] ) except IndexError : print ( "{0} not found" . format ( pattern ) ) raise
Looks for file with pattern with case insensitive search