# -*- coding: utf-8 -*- ''' python读取文件,将文件中的空白行去掉 ''' def delblankline(infile,
outfile): infopen = open(infile, 'r',encoding="utf-8") outfopen = open(outfile,
'w',encoding="utf-8") lines = infopen.readlines() for line in lines: if
line.split(): outfopen.writelines(line)else: outfopen.writelines("")
infopen.close() outfopen.close() delblankline("源文件路径", "目标文件路径")

友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:[email protected]
QQ群:637538335
关注微信