慕沐9044854
2020-10-27 17:01
Traceback (most recent call last):
File "D:/pycode/data_preprocessing/extractTxt.py", line 66, in <module>
files2txt(filepath1)
File "D:/pycode/data_preprocessing/extractTxt.py", line 26, in files2txt
new2txtpath = os.path.join(savepath, new_name)
File "C:\Program Files\Python38\lib\ntpath.py", line 109, in join
genericpath._check_arg_types('join', path, *paths)
File "C:\Program Files\Python38\lib\genericpath.py", line 152, in _check_arg_types
raise TypeError('%s() argument must be str or bytes, not %r' %
TypeError: join() argument must be str or bytes, not 'NoneType'
我觉得你是切割文件名和后缀的时候,splitext写成split导致的。
elif fnmatch.fnmatch(filename, '*.docx'):
写成
if fnmatch.fnmatch(filename, '*.docx'):
,导致new_name返回的是NoneType
Python数据预处理(一)一抽取多源数据文本信息
15943 学习 · 40 问题
相似问题