Remove all javascript tags and style tags from html with python and the lxml module

后端 未结 4 2179
南笙
南笙 2020-12-23 12:11

I am parsing an html document using the http://lxml.de/ library. So far I have figured out how to strip tags from an html document In lxml, how do I remove a tag but retain

4条回答
  •  旧时难觅i
    2020-12-23 12:31

    Below is an example to do what you want. For an HTML document, Cleaner is a better general solution to the problem than using strip_elements, because in cases like this you want to strip out more than just the

提交回复
热议问题