Don't put html, head and body tags automatically, beautifulsoup

前端 未结 8 1528
青春惊慌失措
青春惊慌失措 2020-12-03 09:40

using beautifulsoup with html5lib, it puts the html, head and body tags automatically:

BeautifulSoup(\'

FOO

\', \'html5lib\') # => <
8条回答
  •  孤街浪徒
    2020-12-03 10:17

    Your only option is to not use html5lib to parse the data.

    That's a feature of the html5lib library, it fixes HTML that is lacking, such as adding back in missing required elements.

提交回复
热议问题