import re
d = re.sub('<[^>]+>','',s)
print d
开始1~3
import retest='<p class="pictext" align="center">陈细妹</p>'
test=re.sub(r'(<[^>\s]+)\s[^>]+?(>)', r'\1\2', test)
print(test)
试试这个:
with open('aa.html') as f:s=f.read()
import re
s1=re.sub('<.+?>',' ',s)
with open('bb.html') as wf:
wf.write(s1)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)