77问答网
所有问题
python怎么用正则表达式删除空行
如题所述
举报该问题
推荐答案 2017-04-01
正则表达式
替换所有空行(包括空格行)为空
import re
re.sub(r"\n[\s| ]*\n", '', open('d:/test.txt').
read()
())
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://77.wendadaohang.com/zd/W8NGYNq8YvG8W8GI3W.html
相似回答
大家正在搜
相关问题
python用正则表达式去除空行
python 读取文本文件 删除里边的空行
python如何识别文件中的空行?
python中利用正则表达式的删除特定字符的问题
怎样用正则表达式删除HTML标签
python正则表达式如果存在即删除
Python下正则表达式匹配包括换行符,语句怎么写?求帮忙!
python中利用正则表达式的删除特定字符的问题