You are calling str.find()
, not BeautifulSoup.find()
. You forgot something:
soup = bs4(htmltext)
for price in soup.find(attrs={'id':"yfs_184_aapl"}):
But if you are going to loop, you need to call find_all()
, really:
for price in soup.find_all(id="yfs_l84_aapl"):
You don't actually have to use the attrs
keyword argument; specifying the attributes as keyword arguments directly works fine too.
You do have to use the correct id
attribute; it is yfs_l84_aapl
(letter l
, followed by the digits 8
and 4
), not the digit 1
.