Skip to content

Instantly share code, notes, and snippets.

@icarrr
Created November 20, 2019 15:38
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 icarrr/8dfd0fd4b67479bd09f76985462df3d1 to your computer and use it in GitHub Desktop.
Save icarrr/8dfd0fd4b67479bd09f76985462df3d1 to your computer and use it in GitHub Desktop.
prettify the html
from bs4 import BeautifulSoup as bs
import sys
# But, we'll read from standard input, so we can pipe output to it
# i.e. run with cat filename.html | this_file.py
data = sys.stdin.readlines()
data = "".join(data)
soup = bs(data) #make BeautifulSoup
prettyHTML=soup.prettify() #prettify the html
print (prettyHTML)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment