代码的相关部分:
# Get all files in subdirectories of input directory
files = []
for dir in dirs:
if dir.endswith('.txt'):
continue
dir_files = glob.glob(indir + '/' + dir + '/*.txt')
files.extend(dir_files)
追溯是
Traceback (most recent call last):
File "deduplication.py", line 131, in <module>
main(sys.argv[1:])
File "deduplication.py", line 78, in main
dir_files = glob.glob(indir +
'/' + dir + '/*.txt')
File "/apps/gcc/5.2.0/python/2.7.10/lib/python2.7/glob.py", line 27, in glob
return list(iglob(pathname))
File "/apps/gcc/5.2.0/python/2.7.10/lib/python2.7/glob.py", line 63, in iglob
for dirname in dirs:
File "/apps/gcc/5.2.0/python/2.7.10/lib/python2.7/glob.py", line 64, in iglob
for name in glob_in_dir(dirname, basename):
File "/apps/gcc/5.2.0/python/2.7.10/lib/python2.7/glob.py", line 83, in glob1
return fnmatch.filter(names, pattern)
File "/apps/gcc/5.2.0/python/2.7.10/lib/python2.7/fnmatch.py", line 56, in filter
_cache[pat] = re_pat = re.compile(res)
File "/apps/gcc/5.2.0/python/2.7.10/lib/python2.7/re.py", line 194, in compile
return _compile(pattern, flags)
File "/apps/gcc/5.2.0/python/2.7.10/lib/python2.7/re.py", line 251, in _compile
raise error, v # invalid expression
sre_constants.error: bad character range'
此外,我发现名称为&#34; Yo [U-Turn]&#34;的目录会引发错误。和&#34; PW3 [Epumer-Machi-Judurcha]