惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 司徒正美
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
宝玉的分享
宝玉的分享
量子位
V
Visual Studio Blog
罗磊的独立博客
Vercel News
Vercel News
B
Blog
J
Java Code Geeks
S
SegmentFault 最新的问题
Recent Announcements
Recent Announcements
有赞技术团队
有赞技术团队
P
Proofpoint News Feed
GbyAI
GbyAI
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

博客园 - DavidZang

17款code review工具 IIS ip访问限制插件 iis 限制动态IP地址访问次数 亚马逊AWS云搭建安全、简单(10分钟)、免费(一年)的VPN服务 - DavidZang AWS云使用100条宝贵经验分享 C# 开源框架(整理) 如何获取Azure AD tenant的tenant Id? 基于Deep Learning 的视频识别方法概览 Deep learning深度学习的十大开源框架 windows下,下载pip安装 Apache与Tomcat有什么关系和区别 创建包含多个子网的虚拟网络 适用于 Azure 虚拟网络的常见 PowerShell 命令 手动将经典 VM 从 VHD 迁移到新的 ARM 托管磁盘 VM 将 Windows 虚拟机从非托管磁盘转换为托管磁盘 将 Azure VM 迁移到 Azure 中的托管磁盘 在 Azure Resource Manager 模板中使用托管磁盘 将 Azure 文件共享用于 Windows VM Azure 标准与高级托管磁盘存储的相互转换
python 3.3.2报错:No module named 'urllib2'
DavidZang · 2018-01-11 · via 博客园 - DavidZang

ModuleNotFoundError: No module named 'urllib3'

1. ImportError: No module named 'cookielib'1

Python3中,改成 import  http.cookiejar,然后方法里也改成 http.cookiejar,查找替换就行

2. NameError: name 'raw_input' is not defined
在版本3中已经用input()替换

3. Import error: No module name urllib
from urllib.request import urlopen


4. ImportError: No module named urllib2
Python 3中urllib2用urllib.request替代

在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)

sample:

import urllib.request
resp=urllib.request.urlopen('http://www.baidu.com')
html=resp.read()
print(html)