in the official Python doc there is a note about urllib2 (https://docs.python.org/2/library/urllib2.html) “Note The urllib2 module has been split across several modules in Python 3 named urllib.request and urllib.error. The 2to3 tool will automatically adapt imports when converting your sources to Python 3.”
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.
sir, what is this means ? req = urllib2.Request(‘http://api.pushetta.com/api/pushes/{0}/’.format(c
How do I have to adapt the code by using Python 3.5?
The urllib2 isn‘t working anymore. Thx
Hello Mike,
in the official Python doc there is a note about urllib2 (https://docs.python.org/2/library/urllib2.html) “Note The urllib2 module has been split across several modules in Python 3 named urllib.request and urllib.error. The 2to3 tool will automatically adapt imports when converting your sources to Python 3.”
Then you need to do something like:
import urllib.request
request = urllib.request.Request(‘http://api.pushetta.com/api/pushes/{0}/’.format …
Let me know if you able to make it works.
Bys
Fabrizio