Sunday 15 April 2012

Translating Python 2 code to Python 3 -


<2> 3

What can help me to translate the Python 2 code to Python 3 without using a 2to3 tool could it? urllib2, cookielib self.cj = cookielib.mozillaCookieJar (self.cookie_file) self.opener = urllib2.build_opener (urllib2.HTTPRedirectHandler), urllib2.HTTPHandler (debugleval = 0), urllib2. HTTPSHandler (debuglevel = 0), Urllib2.HTTPCookieProcessor (self.cj))

I Python found the answer through Docs:

  Import http.cookiejar import urllib.request self.cj = http.cookiejar.MozillaCookieJar (self.cookie_file) self.opener = urllib.request.build_opener ( urllib.request.HTTPRedirectHandler), Urllib.request.HTTPHandler (Dibglevl = 0), urllib.request.HTTPSHandler (Dibglevl = 0), urllib.request.HTTPCookieProcessor (self.cj))    

No comments:

Post a Comment