簡體   English   中英

當我不使用BeautifulSoup時如何擺脫BeautifulSoup html解析器錯誤

[英]How to get rid of the BeautifulSoup html parser error when I'm not using BeautifulSoup

我將使用GUI制作字典程序,但我遇到了第一個障礙。 我剛剛安裝了一個模塊( PyDictionary ),但是當我運行以下代碼時,我得到了一個錯誤。

from PyDictionary import PyDictionary
dictionary = PyDictionary()
print(dictionary.meaning("fish"))

哪個返回

The code that caused this warning is on line 3 of the file Dictionary.py. To 
get rid of this warning, change code that looks like this:

 BeautifulSoup(YOUR_MARKUP})

to this:

 BeautifulSoup(YOUR_MARKUP, "lxml")

  markup_type=markup_type))
{'Noun': ['any of various mostly cold-blooded aquatic vertebrates usually having scales and breathing through gills', 'the flesh of fish used as food', '(astrology', 'the twelfth sign of the zodiac; the sun is in this sign from about February 19 to March 20'], 'Verb': ['seek indirectly', 'catch or try to catch fish or shellfish']}

看起來這是PyDictionary一個問題,注意到這里 引發BeautifulSoup錯誤的原因是因為PyDictionary是使用BeautifulSoup實現的。

但是,問題似乎已經解決。 您是否使用pip安裝了PyDictionary? 如果是這樣,請嘗試直接從GitHub存儲庫此處進行安裝。

編輯:我測試使用回購安裝,問題已解決。 我建議您也這樣做。 如果您不確定如何執行此操作,請隨時詢問。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM