Skip to content

Instantly share code, notes, and snippets.

@dongyi
Created September 25, 2017 14:10
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 dongyi/eb5b4a10429844d291726a605b97b0e5 to your computer and use it in GitHub Desktop.
Save dongyi/eb5b4a10429844d291726a605b97b0e5 to your computer and use it in GitHub Desktop.
from bs4 import BeautifulSoup
import sys
def convert_html(filename):
f = open(filename)
soup = BeautifulSoup(f)
f.close()
with open(filename.replace('.html', '.xml'), 'w') as ff:
ff.write(soup.prettify())
if __name__ == '__main__':
import sys
convert_html(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment