Skip to content

Instantly share code, notes, and snippets.

@ercJuL
Created September 4, 2017 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ercJuL/97e27d199451d43f93f14d41625955c9 to your computer and use it in GitHub Desktop.
Save ercJuL/97e27d199451d43f93f14d41625955c9 to your computer and use it in GitHub Desktop.
markup = '<a href="http://example.com/">I linked to <i>example.com</i></a>'
soup = BeautifulSoup(markup)
soup.prettify()
# '<html>\n <head>\n </head>\n <body>\n <a href="http://example.com/">\n...'
print(soup.prettify())
# <html>
# <head>
# </head>
# <body>
# <a href="http://example.com/">
# I linked to
# <i>
# example.com
# </i>
# </a>
# </body>
# </html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment