我有一个目录,里面有不同的停用词文本文件.我想一起导入它们,使用with open()
,但收到一个错误:
file_list = glob.glob(os.path.join(os.getcwd(), "Directory", "*.txt"))
corpus = []
for file_path in file_list:
with open(file_path,'r') as stop_words:
stop_words.append(stop_words.read())
stopWords = stop_words.read().lower()
stopWordList = stopWords.split('\n')
stopWordList[-1:] = []
AttributeError:‘_io.TextIOWrapper’对象没有属性‘append’
谢谢