prof-rossetti / intro-to-python

An Introduction to Programming in Python
Other
97 stars 245 forks source link

Soup - Reading HTML Files #93

Closed s2t2 closed 2 years ago

s2t2 commented 3 years ago

Add to notes about beautiful soup package, a section about parsing a local HTML file (the current example is for live-requested files:

with open('index.html', 'r') as f:

    contents = f.read()

    soup = BeautifulSoup(contents, 'lxml')