Beautifulsoup And
My Code: html = ' ' from bs4 import BeautifulSoup print BeautifulSoup(html).renderContents() The output:   Desired outp
Solution 1:
Use encode_contents instead of renderContents, or encode or prettify. They all support the formatter argument, and pass 'html' as formatter:
html = "<tag> </tag>"from bs4 import BeautifulSoup
print BeautifulSoup(html).encode_contents(formatter='html')
produces:
<tag> </tag>
Post a Comment for "Beautifulsoup And "