Run*_*ean 2 python urllib beautifulsoup
当我运行代码时:
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)
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
File "c:\users\kerss\diet\scrape.py", line 8, in <module>
soup = bs4.BeautifulSoup(html, 'html.parser')
NameError: name 'bs4' is not defined
Run Code Online (Sandbox Code Playgroud)
但是bs4定义了?或不?
| 归档时间: |
|
| 查看次数: |
5365 次 |
| 最近记录: |