def file_matches(filename, patterns):
    """Does this filename match any of the patterns?"""
    return any(fnmatch.fnmatch(filename, pat)
               or fnmatch.fnmatch(os.path.basename(filename), pat)
               for pat in patterns)
def file_matches ( filename , patterns ) : return any ( fnmatch . fnmatch ( filename , pat ) or fnmatch . fnmatch ( os . path . basename ( filename ) , pat ) for pat in patterns )
Does this filename match any of the patterns?