def read_files():
"""该函数用于读取对应文件夹下各txt文件的名字"""
path ='D:/xap/小说/金庸/碧血剑/'
content = ''
for f in range(109):
filename = '第'+str(f+1)+'章 碧血剑('+str(f+1)+').txt'
print("file -> ",filename)
with open( path+filename , 'r' ,encoding='utf-8') as file:
content = content + file.read()
# print("file -> ",file.read())
file.close()
with open(path + '碧血剑.txt', 'a',encoding='utf-8') as file:
file.write("\n")
file.write(filename)
file.write("\n\n")
file.write(content)
file.write("\n\n\n")
content = ''
file.close()
print("done")
if name == 'main':
read_files()