I suggest you to use fnmatch and the upper method. In this way you can find any of the following:
- Name.txt;
- Name.TXT;
- Name.Txt
.
import fnmatch
import os
for file in os.listdir("/Users/Johnny/Desktop/MyTXTfolder"):
if fnmatch.fnmatch(file.upper(), '*.TXT'):
print(file)