python 常见问题总结
1、ModuleNotFoundError: No module named 'urllib2'
在python3.x版本中,urllib和urllib2包集合成在一个包了
import urllib2
response = urllib2.urlopen(request)
改为
import urllib.request
response = urllib.request.urlopen("http://www.fyunw.com")
2、ModuleNotFoundError: No module named 'urlparse'
3.0版本中已经将urllib2、urlparse、和robotparser并入了urllib中,并且修改urllib模块,其中包含5个子模块,即是help()中看到的那五个名字。
urllib.error: ContentTooShortError; HTTPError; URLError
urllib.parse: parseqs; parseqsl; quote; quotefrombytes; quote_plus; unquote unquoteplus; unquoteto_bytes; urldefrag; urlencode; urljoin; urlparse; urlsplit; urlunparse; urlunsplit
urllib.request: AbstractBasicAuthHandler; AbstractDigestAuthHandler; BaseHandler; CatheFTPHandler; FTPHandler; FancyURLopener; FileHandler; HTTPBasicAuthHandler; HTTPCookieProcessor; HTTPDefaultErrorHandler; HTTPDigestAuthHandler; HTTPErrorProcessorl; HTTPHandler; HTTPPasswordMgr; HTTPPasswordMgrWithDefaultRealm; HTTPRedirectHandler; HTTPSHandler;OpenerDirector;ProxyBasicAuthHandler ProxyDigestAuthHandler; ProxyHandler; Request; URLopener; UnknowHandler; buildopener; getproxies; installopener; pathname2url; url2pathname; urlcleanup; urlopen; urlretrieve;
urllib.response: addbase; addclosehook; addinfo; addinfourl;
urllib.robotparser: RobotFileParser
import urlparse
my_url = urlparse.urlparse(url)
改为
import urllib
my_url = urllib.urlparse(url)
python 常见问题总结的更多相关文章
- python常见问题汇总
1.python使用selenium中的时间等待 a.强制等待 time.sleep() b.隐式等待: 如果某些元素不是立即可用的,隐式等待是告诉WebDriver去等待一定的时间后去查找元素. 默 ...
- python 常见问题
C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts\ C:\Users\user\AppData\Local\Programs\P ...
- Python常见问题
1. 处理中文时出现的错误'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)" 解决方 ...
- Python常见问题系列
Python基础题1.冒泡排序 def mao_pao(li): for i in range(len(li)): for j in range(len(li)): if li[i] < li[ ...
- python常见问题一(安装报错)
常见问题一:我在安装python2.7时,提示错误:'An error occurred during the installation of assembly 'Microsoft.VC90.CRT ...
- 【Python常见问题总结】
1. python2 中 end = '' 取消换行没有用 解决办法: 在程序开始加入 from __future__ import print_function 2. 如何在电脑上同时使用pytho ...
- python常见问题解决方案
平时工作中经常需要用到这些python小技巧,顺便做个记录 import requests import time def get_pr(domain): pr = 6 time.sleep(1) h ...
- Python常见问题及资料收集
1,字符编码处理: http://bbs.chinaunix.net/thread-1431029-1-1.html
- 学习笔记32—python常见问题及解决办法
1.Anaconda3 中 Spyder 无法打开/点击没有反应 应对方法 1).通过pip安装pyqt5:pip install pyqt5 2).输入以下命令:spyder --new-insta ...
随机推荐
- Linux学习笔记之Linux启动级别
对于绝大多数Linux程序员来说,进入Linux系统后一般看到的是黑乎乎的界面(开发模式),因为系统如果启动选择开发模式,会减少启动时间,优化内存等.但是通常我们刚安装完Linux系统,然后进去以后是 ...
- FastDFS+Nginx分布式文件系统部署安装
安装: ##安装tracker.storage参考:http://www.cnblogs.com/zclzhao/p/5025229.html nginx代理设置参考:http://www.cnblo ...
- 20145312《网络对抗》Exp4 恶意代码分析
20145312<网络对抗>Exp4 恶意代码分析 问题回答 1.总结一下监控一个系统通常需要监控什么.用什么来监控. 监控一个系统通常需要监控这个系统的注册表,进程,开放端口,程序服务还 ...
- Applet初次使用
ZLYD团队Apllet学习笔记 初识Applet Applet是采用Java编程语言编写的小应用程序,该程序可以包含在 HTML(标准通用标记语言的一个应用)页中,与在页中包含图像的方式大致相同.J ...
- ThinkPHP开发博客系统笔记之一
1.前后台搭建 开发的第一步是搭建前后台系统.搭建前台系统的时候新建了LoginController控制器和登录界面View/Login/index.tpl.模板文件中需要引入js和css文件,这里想 ...
- Execution Order for the ApiController
Execution Order for the ApiController Assuming the request goes into the ApiController scope, the op ...
- 【问题解决:未找到端口号】启动报错Circular placeholder reference 'server.port' in property definitions
问题描述: 启动spring boot项目时报错:Circular placeholder reference 'server.port' in property definitions 解决过程: ...
- 理解if __name__ == '__main__':
一开始没怎么注意这个语句,这两天在模拟知乎登陆时准备刨根问底了,先看两行代码片段 第一个例子:这是在login.py文件的一部分,其他我们忽略,只关注print()函数的内容 import time ...
- JAVA消息 JMS 很重要
首先大致讲一下,java 消息模块 消息,个人理解分为两种:1.同步消息(RPC调用) 2.异步消息(本篇讲解部分) 一.同步消息java提供了多种方案: 最新比较常用的方式就是spring Http ...
- .Net Core中使用UEditor
一.下载解压UEditor的.net版本(这个直接使用的话是asp.net的版本) 我下载的是这个 再给留上地址http://ueditor.baidu.com/website/download.ht ...