申请域名网站价格,网站建设模块是什么,做古玩的网站,上海青浦做网站PyCharm无代码提示解决方法
在使用PyCharm工具时#xff0c;调用方法却无法进行提示#xff0c;针对PyCharm无代码提示整理下解决方案
1、Python内置语法无智能提示 复现#xff1a;我这里以urllib库读取网页内容为例#xff0c;在通过urlopen(#xff09;之后调用getur…PyCharm无代码提示解决方法
在使用PyCharm工具时调用方法却无法进行提示针对PyCharm无代码提示整理下解决方案
1、Python内置语法无智能提示 复现我这里以urllib库读取网页内容为例在通过urlopen(之后调用geturl()函数时无提示
import urllib.request
urlhttps://www.baidu.com/
burllib.request.urlopen(url)
# print(type(b))
# print(b.geturl())解决办法查看b的返回类型这里是http.client.HTTPResponse此时可以导入import http.client并在其后面进行注释 # type: http.client.HTTPResponse或者添加代码行assert isinstance(b, http.client.HTTPResponse) 如下
import urllib.request
import http.client
urlhttps://www.baidu.com/
burllib.request.urlopen(url) # type: http.client.HTTPResponse
assert isinstance(b, http.client.HTTPResponse)
print(type(b))
print(b.geturl())此时再次调用就可以自动提示。