In brief
fnmatch compares names with shell-style patterns. fnmatch.fnmatchcase('report.csv', '*.csv') is True, and fnmatchcase preserves case sensitivity.
Useful to know
fnmatch compares names with shell-style patterns. fnmatch.fnmatchcase('report.csv', '*.csv') is True, and fnmatchcase preserves case sensitivity. [1]
These patterns are not the full grammar of regular expressions. The module does not traverse directories for you. Decide whether you are checking a name or a full path, and do not treat an extension match as proof of a file’s actual type.
Sources
For further detail and to check the information: