自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 收藏
  • 关注

原创 TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

pip install 包报错:TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'解决:·TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'·sudo apt-get install python-pip

2018-02-01 12:02:23 5949

原创 Python swapcase()

Python swapcase() 方法用于对字符串的大小写字母进行转换。swapcase()方法语法:str.swapcase();

2017-12-18 17:09:01 1323

转载 转换编码 u'```'

>>> s = u'\xb3\xc2\xbd\xa8\xc3\xf4'>>> s.encode('raw_unicode_escape')

2017-12-05 18:02:33 399

转载 转载留存安装lxml

http://blog.csdn.net/wang1144/article/details/42277179侵删

2017-10-10 12:15:24 272

原创 记录redis MD5数据库入库去重

记录下mysql 入库去重:import hashlib, redisred = redis.Redis(host="118.26.185.188", port=6379)mdkey = hashlib.md5()mdkey.update(a+b+c+d+g+i)zhujian = mdkey.hexdigest()if not self.red.get(zhujian):

2017-08-10 15:43:49 895

转载 scrapy IP 池

http://blog.csdn.net/Gooooa/article/details/74452203转载留存,侵删

2017-07-18 17:27:59 538

转载 转载ubuntu安装Scrapy

Scrapy是Python开发的一个快速,高层次的屏幕抓取和web抓取框架,用于抓取web站点并从页面中提取结构化的数据。Scrapy用途广泛,可以用于数据挖掘、监测和自动化测试。 官网网站http://www.scrapy.org/1、安装如下软件sudo apt-get install build-essential;sudo apt-get install

2017-06-30 11:18:48 377

原创 使用scrapy爬取CR糗百图片

记录一下使用SCRAPY爬取糗百图片1.创建项目:使用命令行提示符输入:scrapy  startproject tupian www.chengrenqiubai.com2.打开项目目录,编辑items文件,内容:import scrapyclass TupianItem(scrapy.Item): # define the fields for your it

2017-06-25 14:38:07 785

转载 python 3 requests模块

点击打开链接大牛整理的

2017-06-21 17:32:52 317

原创 Xpath 模糊搜索

##xpath 模糊搜索,通过关键字匹配例子:

2017-06-08 17:24:44 860

原创 Python count()

Python count() 方法用于统计字符串里某个字符出现的次数。可选参数为在字符串搜索的开始与结束位置。count()方法语法:str.count(sub, start= 0,end=len(string))sub -- 搜索的子字符串start -- 字符串开始搜索的位置。默认为第一个字符,第一个字符索引值为0。end -- 字符串中结束搜索的位置。字符中第一个字符的索

2017-05-08 11:30:29 490

原创 Python isdigit()

isdigit() 是判断字符串是否只为数字组成,返回True or Falsestr.isdigit()

2017-05-05 14:21:08 536

原创 Python replace()

replace 是将字符串old替换为newstr.replace(old, new[, max])>>> a = 'sdfaf,sda,f,dsaf,asd,f,sadf,'>>> a.replace(',','')'sdfafsdafdsafasdfsadf'max为替换不超过max次数>>> a.replace('sd','77',2)'77faf,77a

2017-05-05 13:55:07 684

原创 Python case str[::-1]

Instructions:Reverse every other word in a given string, then return it. Don't forget to include the spaces!def test(s): rr = [] a = s.split(' ') for i in a : # if i 角标为偶数

2017-04-27 10:14:38 867

原创 Python isinstance

记录isinstance 例子一个:给出列表,输出整数部分列表例子:def filter_list(l):    a = l    c = []    for x in a:        if isinstance(x,int)==True:            c.append(x)    return cisinstance 用来判断数据类型

2017-04-26 12:48:24 278

原创 Python 错误处理

当我们认为某些代码可能会出错时,就可以用try来运行这段代码,如果执行出错,则后续代码不会继续执行,而是直接跳转至错误处理代码,即except语句块,执行完except后,如果有finally语句块,则执行finally语句块,至此,执行完毕。例:>>> a = bTraceback (most recent call last):  File "", line 1, in

2017-04-22 14:11:23 443

原创 Python 菲波那切数列

菲波那契数列指的是这样一个数列:1,1,2,3,5,8,13,21 ,34,55 , 89 , 144 ……这个数列从第三项开始,每一项都等于前两项之和例:def feb(max):    n,a,b = 0,0,1    L = []    while n         L.append(b)        a,b = b,a+b     

2017-04-22 13:52:34 1796

原创 Python assert 用法

Python中assert用来判断语句的真假,如果为假的话将触发AssertionError错误python help document的解释:Assert statements are a convenient way to insert debugging assertions into a program:例:>>> a = 3>>> assert a ==3>>>

2017-04-20 21:54:55 447

原创 Ubuntu下网络设定

工作中经常用到Ubuntu网络设定,以eth0为例,记录网络配置:首先 ifconfig -a 列出所有网口:然后进行网络配置,输入内容如下:auto eth0iface eth0 inet staticaddress 172.16.21.123netmask 255.255.255.0gateway 172.16.21.254broadcast 172.16.

2016-12-07 11:35:50 304

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除