Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add 1st example to chapter2
  • Loading branch information
will-i-amv authored Jun 30, 2021
commit 47fbd43a68da7e9b8d9bd982f2e4391d89c93a76
9 changes: 9 additions & 0 deletions v2/chapter2/1-selectByClass.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from urllib.request import urlopen
from bs4 import BeautifulSoup


html = urlopen('http://www.pythonscraping.com/pages/page1.html')
bs = BeautifulSoup(html.read(), 'html.parser')
nameList = bs.findAll('span', {'class':'green'})
for name in nameList:
print(name.get_text())