Intellisense未显示库的所有类定义

2024-10-05 10:13:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在为这个项目使用visualstudioide(它有python3.x)。我尝试用pip(对于web scraper)安装requestslxml,我成功地安装了它,导入了它,并写了这样一行:

__page = requests.get("www.google.com")

然后我试着去做

__page.content()

但很显然,这并没有定义。这不是唯一一个这样做的软件包。它也发生在lxmlbeautifulsoup。你知道吗

有什么办法吗?你知道吗

图片:https://imgur.com/a/wVerZ


Tags: pip项目comwebget定义wwwgoogle
1条回答
网友
1楼 · 发布于 2024-10-05 10:13:49

__page.text()看起来不像函数,它看起来像属性,即__page.text。你知道吗

http://docs.python-requests.org/en/master/api/#requests.Response.text

text

Content of the response, in unicode.

If Response.encoding is None, encoding will be guessed using chardet.

The encoding of the response content is determined based solely on HTTP headers, following RFC 2616 to the letter. If you can take advantage of non-HTTP knowledge to make a better guess at the encoding, you should set r.encoding appropriately before accessing this property.

相关问题 更多 >

    热门问题