利用shell通配符查看匹配字符串
"""
问题3:利用shell 通配符做字符串匹配
使用通配符*,?,【0-9】做匹配符
fnmatch 不区分大小写
fnmatchcase 区分大小写
"""
from fnmatch import fnmatch, fnmatchcase
print(fnmatch("foo.txt", "*.txt"))
print(fnmatch("foo.txt", "?oo.txt"))
names = ["Dat1.csv","Dat2.csv","config.ini","foo.py"]
print([name for name in names if fnmatch(name,"Dat[0-9].csv")])