如何在Python 批量修改HTML文件里的span内容
展开全部
因为你的html不是合法的xml格式,标签没有成对出现,只能用html解析器
from bs4 import BeautifulSoup
s = """
</span><span style= 'font-size:12.0pt;color:#CC3399'>714659079qqcom 2014/09/10 10:14</span></p></div>
soup = BeautifulSoup(s, "html.parser")
print soup
print soup.get_text()
from bs4 import BeautifulSoup
s = """
</span><span style= 'font-size:12.0pt;color:#CC3399'>714659079qqcom 2014/09/10 10:14</span></p></div>
soup = BeautifulSoup(s, "html.parser")
print soup
print soup.get_text()
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询