python正则使用笔记
def remove_br(content): """去除两边换行符""" content = content.replace("", "").replace("", "") while re.findall("^|$", content): content = re.sub(r'^|$', "", content) return contentif __name__ == "__main__": s = remove_br("abc") print s
.
本文共 330 字,大约阅读时间需要 1 分钟。
python正则使用笔记
def remove_br(content): """去除两边换行符""" content = content.replace("", "").replace("", "") while re.findall("^|$", content): content = re.sub(r'^|$', "", content) return contentif __name__ == "__main__": s = remove_br("abc") print s
.
转载于:https://www.cnblogs.com/weiok/p/5433578.html