使用带有html5lib的beautifulsoup,它会自动放置html,head和body标签:
BeautifulSoup('<h1>FOO</h1>', 'html5lib') # => <html><head></head><body><h1>FOO</h1></body></html>
我可以设置任何选项,关闭此行为?
python beautifulsoup html5lib
beautifulsoup ×1
html5lib ×1
python ×1