- if I ==’’:
def handle_file(xucubiao_path):
global word_list
word_list=[]
files = os.listdir(xucubiao_path)
for file in files:
words = file.split('.')[0]
word_list.append(words)
for i in word_list:
if i == '':
word_list.remove(i)
return word_list
- line.strip()
for word_name in word_list:
with open(xucubiao_path+word_name+'.txt',encoding='utf-8') as text_all:
lines = [line for line in text_all.read().split('\n') if line.strip()]