Python fnmatch - zhongjiajie/zhongjiajie.github.com GitHub Wiki
Unix filename pattern matching, 官网
import fnmatch
import os
for file in os.listdir('.'):
if fnmatch.fnmatch(file, '*.txt'):
print(file)
Return the subset of the list of names that match pattern. It is the same as [n for n in names if fnmatch(n, pattern)], but implemented more efficiently.