Skip to content

Instantly share code, notes, and snippets.

@EdwardIII
Created October 12, 2012 14:39
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 EdwardIII/3879527 to your computer and use it in GitHub Desktop.
Save EdwardIII/3879527 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from bs4 import BeautifulSoup
import fnmatch
import os
import re
for root, dirnames, filenames in os.walk('.'):
for filename in fnmatch.filter(filenames, '*.html'):
f = open(os.path.join(root, filename), 'r+')
soup = BeautifulSoup(f.read());
print "Replacing %s/%s" % (root, filename)
f.write(str(soup))
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment