urllib.request in Python 2.7

妖精的绣舞 提交于 2019-11-27 19:48:06

It is also possible to use six module to make code for both python2 & python3:

from six.moves import urllib
# ...
result = urllib.request.urlopen(url)

Take a look at http://docs.python.org/library/urllib2.html.

The urllib2 module is the predecessor to urllib.request/urllib.error (it has been split into those modules in Python 3.0).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!