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

推荐订阅源

WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
MyScale Blog
MyScale Blog
博客园_首页
G
Google Developers Blog
博客园 - 【当耐特】
美团技术团队
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News
小众软件
小众软件
博客园 - 司徒正美
雷峰网
雷峰网
T
Tailwind CSS Blog
V
V2EX
博客园 - 三生石上(FineUI控件)
F
Fortinet All Blogs
罗磊的独立博客
量子位
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog

博客园 - 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)