呃呃呃,想使用urllib
库进行HTTP 调用,然后发现有些地方没有代码提示。。。这就很难受了,我根本不清楚API的,你不给我一点提示就过分了呀!!!
from urllib import request
def demo():
s = request.urlopen('http://www.baidu.com')
// 没有提示。。。
s._
if __name__ == '__main__':
demo()
经过一些资料查阅,发现了这些解决方法,仅供参考:
from urllib import request
from http.client import HTTPResponse
def demo():
s = request.urlopen('http://www.baidu.com')
assert isinstance(s, HTTPResponse)
// 这就有提示了
s.read()
if __name__ == '__main__':
demo()
from urllib import request
from http.client import HTTPResponse
def demo():
s = request.urlopen('http://www.baidu.com') # type: HTTPResponse
// 这样也OK!
s.read()
if __name__ == '__main__':
demo()
from urllib import request
from http.client import HTTPResponse
def demo():
s = request.urlopen('http://www.baidu.com')
""":type:HTTPResponse"""
// 这样也是OK滴!
s.read()
if __name__ == '__main__':
demo()