Created
November 20, 2019 15:38
-
-
Save icarrr/8dfd0fd4b67479bd09f76985462df3d1 to your computer and use it in GitHub Desktop.
prettify the html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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