file=open(r"D:\Desktop\\参考文献1.txt")##并行前的txt
file_write=open(r'D:\Desktop\参考文献2.txt',mode='w')##并行后的txt
lines = file.readlines()
print(lines)
pi_string = ''
for line in lines:
if line !="\n":
pi_string += line.rstrip()##合并空行前的字符
else:
file_write.write(pi_string+'\n')
pi_string = ''
file_write.write(pi_string+'\n')
file_write.close()
批量下载网站
具体使用参考:https://blog.csdn.net/qq_41704415/article/details/122332647