这就是我在 ipython 中所做的(我使用的是 Python 3.6)
from PyDictionary import PyDictionary
dictionary = PyDictionary()
list = dictionary.synonym("life")
我得到了错误:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PyDictionary/utils.py:5: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html5lib"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
The code that caused this warning is on line 5 of the file /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PyDictionary/utils.py. To get rid of this warning, pass the additional argument 'features="html5lib"' to the BeautifulSoup constructor.
return BeautifulSoup(requests.get(url).text)
life has no Synonyms in the API
我尝试的每个单词都会发生这种情况,我做错了什么吗?是我需要添加参数'features="html5lib"'的问题吗,如果是,BeautifulSoup 构造函数在哪里,我该怎么做?