[英]pycharm intelisense issue with builtin method
I use Pycharm 2020, already try to restart and invalidate cache, adding virtual environment and Pycharm still not able to show builtin method from Python interpreter我使用 Pycharm 2020,已经尝试重新启动并使缓存无效,添加虚拟环境和 Pycharm 仍然无法显示来自 ZA7F5F35426B92741117FC9231B5638 解释器的内置方法
here is my sample code, when i type contents = response.
这是我的示例代码,当我输入
contents = response.
Pycharm not showing read() method, however if I type manually there is no error and I can run my code. Pycharm 没有显示 read() 方法,但是如果我手动输入没有错误,我可以运行我的代码。
How i can fix this?我该如何解决这个问题? I have try many thing when searching in SO, including restart, create new project, adding venv, restart Pycharm etc.
在 SO 中搜索时,我尝试了很多事情,包括重新启动、创建新项目、添加 venv、重新启动 Pycharm 等。
Try using the below link.尝试使用以下链接。
PyCharm makes completion suggestions based on the type inferred for some particular variable or attribute. PyCharm 根据为某些特定变量或属性推断的类型提出补全建议。
Type of response
could be checked by View - Type Info
, inferred type is Any
and that means that actual type is unknown. response
类型可以通过View - Type Info
检查,推断类型是Any
,这意味着实际类型未知。
It could be easily fixed using type hints:可以使用类型提示轻松修复它:
from http.client import HTTPResponse
res = urlopen("http://google.com") # type: HTTPResponse
or或者
res: HTTPResponse = urlopen("http://google.com")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.