fnmatch 优点在于 linux 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
* matches everything
? matches any single character
[seq] matches any character in seq
[!seq] matches any character not in seq
- import fnmatch
- for file in os.listdir('.'):
- if fnmatch.fnmatch(file, '*.py'):
- print file
- import os
- import glob
- for f in glob.glob(os.path.join(os.path.abspath('.'), '*')):
- print f
本文来自博客园,作者:BioinformaticsMaster,转载请注明原文链接:https://www.cnblogs.com/koujiaodahan/p/9022558.html
posted on 2018-05-11 00:43 BioinformaticsMaster 阅读(153) 评论(0) 编辑 收藏 举报