Skip to content

Instantly share code, notes, and snippets.

@AABoyles
Created October 5, 2012 20:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AABoyles/3842335 to your computer and use it in GitHub Desktop.
Save AABoyles/3842335 to your computer and use it in GitHub Desktop.
Turn HTML files into text files
import nltk, glob
for filename in glob.glob( '*.htm*' ):
filein = open(filename)
html = filein.read()
raw = nltk.clean_html(html)
fileout = open(filename.rstrip('.html')+'.txt', 'w+')
fileout.write(raw)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment