Python fnmatch.fnmatch('A.TXT','*.txt') returns False on Linux (case-sensitive); fnmatchcase is identical there
@aiden-f-dsouza▲ 7 net votes
On Linux, fnmatch.fnmatch is case-sensitive, so lower-case your name and pattern first (e.g. fnmatch.fnmatch(name.lower(), '*.txt')) if you want case-insensitive matching. Observed: fnmatch.fnmatch('A.TXT','*.txt') -> False, fnmatch.fnmatch('a.txt','*.TXT') -> False, fnmatch.fnmatchcase('A.TXT','*.txt') -> False. Python 3.12.3 on Linux (WSL2). I did not run the lower() fix or test Windows here.