Created
May 25, 2015 07:23
-
-
Save itkr/964bf79235e995cbb63d to your computer and use it in GitHub Desktop.
Auto HTML Formatter
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
#!/usr/bin/env python | |
import codecs | |
import sys | |
from bs4 import BeautifulSoup | |
def main(argv): | |
file_path = argv[1] | |
with open(file_path, 'r') as f: | |
html = BeautifulSoup(f.read()).prettify() | |
with codecs.open(file_path, 'w', 'utf-8') as f: | |
f.write(html) | |
if __name__ == '__main__': | |
main(sys.argv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment