'''
fnmatch模块: 提供对Unix Shell通配符的支持
Pattern Meaning
* matches everything
? matches any single character
[seq] matches any character in seq
[!seq] matches any character not in seq
'''
glob模块: 查找所有满足Unix Shell模式规则的路径名
'''
fnmatch模块: 提供对Unix Shell通配符的支持
Pattern Meaning
* matches everything
? matches any single character
[seq] matches any character in seq
[!seq] matches any character not in seq
'''
import os
import fnmatch
for file in os.listdir('.'):
if fnmatch.fnmatch(file, '*.py'):
print file
'''
glob模块: 查找所有满足Unix Shell模式规则的路径名
'''
import os
import glob
for f in glob.glob(os.path.join(os.path.abspath('.'), '*')):
print f