When I run the code:
import requests
from bs4 import BeautifulSoup
import urllib
response = urllib.urlopen('file:///Users/kerss/diet/sesame_seeds.html')
html = response.read()
soup = bs4.BeautifulSoup(html, 'html.parser')
span = soup.find("span", id="NUTRIENT_0")
print(span.text)
I get the following error:
File "c:\users\kerss\diet\scrape.py", line 8, in <module>
soup = bs4.BeautifulSoup(html, 'html.parser')
NameError: name 'bs4' is not defined
but bs4 is defined? or not?
Just use soup = BeautifulSoup(html, 'html.parser')