python glob 默认无法找到 没有文件名只有扩展名的文件!
因为 .txt这样以·.·开头的文件是被视作隐藏文件的,glob默认不予支持
因此有两种解决方法
- https://stackoverflow.com/questions/49047402/python-3-6-glob-include-hidden-files-and-folders
Note that files beginning with a dot (.) can only be matched by patterns that also start with a dot, unlike fnmatch.fnmatch() or pathlib.Path.glob(). (For tilde and shell variable expansion, use os.path.expanduser() and os.path.expandvars().
采用多个glob语句
- os.walk