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
現在可以運作了。