-
-
Save formido/36993 to your computer and use it in GitHub Desktop.
This file contains 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
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