Skip to content

Instantly share code, notes, and snippets.

@formido
Created December 17, 2008 07:58
Show Gist options
  • Save formido/36993 to your computer and use it in GitHub Desktop.
Save formido/36993 to your computer and use it in GitHub Desktop.
root = "/a/b/c/d/"
def removeroot(path):
return path.replace(root, "")
from BeautifulSoup import BeautifulSoup
pathtohtml = "/Users/formido/tmp/vallejo.html"
import os
os.path.exists(pathtohtml)
file = open(pathtohtml)
html = file.read()
print html
soup = BeautifulSoup(html)
# will be None if it's not there
layer3 = soup.find(id="Layer3")
layer2 = layer3.prettify().replace("Layer3", "Layer2")
soup.find('title')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment