【发布时间】:2017-07-06 19:35:49
【问题描述】:
我正在通过它的所有标签解析 html 文件,当我遇到 body 标签时,我想执行一些字符串操作并将结果保存回 html 文件。当我尝试
if tag.name == 'body':
// go inside the loop
if 循环本身没有得到处理。检查标签名称是否与body标签对应的正确方法是什么
【问题讨论】:
-
你可以使用beautiful soup 模块,它是为解析web html而设计的
标签: python html python-2.7 python-3.x beautifulsoup