打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
ImportError: No module named urllib2

在使用Python3.2时候

import urllib2发现有错

ImportError: No module named urllib2

在Python官方文档里面已有说明:

Note

The urllib2 module has been split across several modules in Python 3.0 named urllib.request and urllib.error. The 2to3 tool will automatically adapt imports when converting your sources to 3.0.

from urllib.request import urlopen

response = urlopen("http://www.google.com")
html = response.read()
print(html)
 

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
python urllib爬取网页编码问题
Python 3 抓取网页资源的 N 种方法
Python如何使用urllib2获取网络资源[转] - python中的网络编程 - 不...
Python爬虫日记一:爬取豆瓣电影中速度与激情8演员图片
Python 标准库 urllib2 的使用细节
Python3之urllib库的使用总结
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服