soup = BeautifulSoup(f, 'xml')
NameError: name 'BeautifulSoup' is not defined
打开文件,发现需要导入
from bs4 import BeautifulSoup
这是解析数据集需要的。然后
pip install bs4
但是出现新的错误:
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: xml. Do you need to install a parser library?
再安装lxml
pip install lxml
现在可以运行了。