0

我用python做了一个简单的字典。这是代码:

from PyDictionary import PyDictionary


def function():
    x = input("Look up: ")
    print(PyDictionary.meaning(x))
    function()


def main():
   function()


if __name__ == '__main__':
    main()

当我运行它时,我收到以下错误消息:

UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this 
system ("html.parser"). 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 
C:\Users\ethan\AppData\Roaming\Python\Python38\site-packages\PyDictionary\utils.py. To get rid 
of this warning, pass the additional argument 'features="html.parser"' to the BeautifulSoup 
constructor.

return BeautifulSoup(requests.get(url).text)

有谁知道如何摆脱它?我也不知道“BeautifulSoup 构造函数”是什么。

我的python构建:

PyCharm 2019.3.3 (Community Edition)
Build #PC-193.6494.30, built on February 6, 2020
Runtime version: 11.0.5+10-b520.38 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 725M
Cores: 4
Registry: 
Non-Bundled Plugins: aws.toolkit
4

0 回答 0