您正在阅读错误的文档或错误的Python解释器版本。您尝试在Python 2中使用Python 3库。
采用:
import urllib2sock = urllib2.urlopen("http://diveintopython.org/") htmlSource = sock.read() sock.close() print htmlSource
Python
2
urllib2库
urllib.request在Python
3中被替换。
欢迎分享,转载请注明来源:内存溢出
您正在阅读错误的文档或错误的Python解释器版本。您尝试在Python 2中使用Python 3库。
采用:
import urllib2sock = urllib2.urlopen("http://diveintopython.org/") htmlSource = sock.read() sock.close() print htmlSource
Python
2
urllib2库
urllib.request在Python
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)