folder : file1.txt, file2.txt, file101.txt, file102.txt, file_a.txt, file_b.txt, file1.jpg, file2.jpg
folder/sub_folder : subfile1.txt, subfile2.txt
folder/sub_folder/sub/sub2 : sub2.txt
import glob
output = glob.glob('folder/*.txt')
print(output)
['folder/file1.txt', 'folder/file102.txt', 'folder/file2.txt', 'folder/file_a.txt', 'folder/file_b.txt']
output = glob.glob('folder/file?.*')
print(output)
['folder/file1.bmp', 'folder/file1.txt', 'folder/file2.bmp', 'folder/file2.txt', 'folder/file_a.txt', 'folder/file_b.txt']
output = glob.glob('folder/**xt')
print(output)
['folder/file1.txt', 'folder/file102.txt', 'folder/file2.txt', 'folder/file_a.txt', 'folder/file_b.txt', 'folder/file12.txt]
output = glob.glob('folder/file[0-9]*.txt')
print(output)
['folder/file1.txt', 'folder/file102.txt', 'folder/file2.txt']