有没有人能帮我把这段python 2代码翻译成python 3而不用2to3工具?
import urllib2, cookielib
self.cj = cookielib.MozillaCookieJar(self.cookie_file)
self.opener = urllib2.build_opener(
urllib2.HTTPRedirectHandler(),
urllib2.HTTPHandler(debuglevel=0),
urllib2.HTTPSHandler(debuglevel=0),
urllib2.HTTPCookieProcessor(self.cj)
)发布于 2013-06-21 21:24:06
我自己通过Python文档得到了答案:
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(debuglevel=0),
urllib.request.HTTPSHandler(debuglevel=0),
urllib.request.HTTPCookieProcessor(self.cj)
)https://stackoverflow.com/questions/17233274
复制相似问题