Python3.3中的urllib

在python3.3中urllib和2.x版本中有很大区别,在3.0的change log中提到

a new urllib package was created. Itconsists of code from urllib, urllib2, urlparse, and robotparser. The old modules have all beenremoved. The new package has five submodules: urllib. parse, urllib.request, urllib.response, urllib.error,urllib.robotparser. The urllib.request.urlopen() function uses the url openerfrom urllib2. (Note that the unittestshave not been renamed for the beta, but they will berenamed in the future.)

3.0版本中已经将urllib2、urlparse、和robotparser并入了urllib中,并且修改urllib模块,其中包含5个子模块,

以前的url.open()现在修改为 data = urllib.request.urlopen(line)

你可能感兴趣的:(Python3.3中的urllib)