自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 selenium实现爬取隐藏标签的内容

   js1 = '''var x = document.evaluate("'''+loop_xpath+'''",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null); var i; console.log(x.snapshotLength) for (i = ...

2018-12-03 11:40:32 5608

转载 selenium 爬虫

https://www.cnblogs.com/Snail-offort/p/8761652.htmlSelenium 的初衷是打造一款优秀的自动化测试工具,但是慢慢的人们就发现,Selenium 的自动化用来做爬虫正合适。我们知道,传统的爬虫通过直接模拟 HTTP 请求来爬取站点信息,由于这种方式和浏览器访问差异比较明显,很多站点都采取了一些反爬的手段,而 Selenium 是通过模拟浏览器...

2018-09-04 16:35:14 402

转载 win10 安装 mysql5.6

https://blog.youkuaiyun.com/qq_41307443/article/details/79839558

2018-06-26 21:19:16 554

原创 4sums

https://leetcode.com/problems/4sum/description/For example, given array S = [1, 0, -1, 0, -2, 2], and target = 0.A solution set is:[ [-1, 0, 0, 1], [-2, -1, 1, 2], [-2, 0, 0, 2]]思想: 找出两个数的...

2018-03-08 16:34:15 208

原创 block_socket_server

import socketsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)sock.bind(('192.168.1.178', 9200))sock.listen(5)while True: soc...

2018-03-06 21:53:39 394

原创 scrapy dispatcher

from pydispatch import dispatcherSIGNAL = 'aa'SIGNAL1='bb'def handle_event(sender): print 'signal aa is send by', senderdef handle_event1(sender): print 'signal bb is send by', senderd...

2018-03-06 14:59:06 1623

原创 centos 下zookeeper 集群模式的安装和配置

centos7对每台主机1.安装jdk2.zookeeper安装不同之处是,在conf/zoo.cfg上server.1=192.168.1.178:20881:30880server.2=192.168.1.222:20881:30881http://blog.youkuaiyun.com/tilyp/article/details/727808513.两台主机能通信

2017-12-08 14:48:52 181

原创 scrapy splash 实现下滑加载

实现滚轴下拉加载页面的splash script(Lua 脚本)方法1function main(splash, args) splash:set_viewport_size(1028, 10000) splash:go(args.url) local scroll_to = splash:jsfunc("window.scrollTo") scroll_to(0,

2017-11-23 16:47:57 4630 1

原创 scrapy shell 爬取一些网站不响应

在爬去京东某商品网页时,如https://search.jd.com/Search?keyword=%E6%83%A0%E6%99%AE&enc=utf-8&suggest=1.his.0.0&wq=&pvid=d66c3ae3039d42b09f015585015ef653    实际上用   https://search.jd.com/Search?keyword=惠普&enc=utf-8

2017-11-19 21:43:08 3210

原创 centos 安装MySQL

MySQL用户名root   无密码: 1.  下载mysql的repo源wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm2.  安装mysql-community-release-el7-5.noarch.rpm包rpm -ivh mysql-community-relea

2017-11-12 12:21:58 175

原创 u盘安装centos7

一般安装centos有两种方法:通过光盘(CD-ROM Drive)引导,通过u盘(Removable Devices)引导这里通过U盘引导1.下载centos镜像:CentOS-7.0-1406-x86_64-DVD.iso (大小大约7G/4G)2.用UltraISO软件把U盘制作成启动盘          先将镜像在该软件中打开,然后启动->写入硬盘映像3.以上u

2017-11-11 21:17:17 400

原创 三个数之和(3sum)

https://leetcode.com/problems/3sum/description/题目描述:给一个含n个整数的数组,找出不重复的所有的三个数相减为0的三元组For example, given array S = [-1, 0, 1, 2, -1, -4],A solution set is:[ [-1, 0, 1], [-1, -1, 2]]vecto

2017-11-10 16:15:21 496

原创 最长公共前缀(Longest Common Prefix)

https://leetcode.com/problems/longest-common-prefix/description/题目大意:Write a function to find the longest common prefix string amongst an array of strings.在一组字符串中找最长公共前缀。思路:vector结构体,最简单的思路就是最长前

2017-10-23 20:32:25 800

原创 string和vector易错点

string a="";string b="aaaa";for(i=0;i a+=b[i];}1.注意点:std::string 的输出是根据记录的长度而不是 '\0' 来判断结束的,想对string一个字符一个字符的复制,只能+=,不能a[i]=b[i];2.vector   容器里:strs.size() strs[0].size()int main()

2017-10-23 19:35:38 410

原创 罗马数字变数字(Roman to Integer)

https://leetcode.com/problems/roman-to-integer/description/上一题的反向出题:思路:既然知道罗马数字里的字符都只表示千级,百级,十级.....故一个字符一个字符的扫描,将其所对应的数字相加即可。注意小的在大的前面是相减实现:想用c++的map容器,出错。。。大神指导一下map初始化:#include#include#in

2017-10-21 20:45:24 276

原创 将数字转换为罗马数字(Integer to Roman)

https://leetcode.com/problems/integer-to-roman/description/题目大意:将数字转化为罗马数字(数字范围1--3999)思路:罗马数字的构成          1(I)   5(V)   10(X)  50(L)   100(C)   500(D)    1000(M)          以上重复几次就是几倍,如20(XX)

2017-10-15 13:52:32 2234

原创 含水最多的容器(Container With Most Water)

https://leetcode.com/problems/container-with-most-water/description/题目大意:给n个数,a1,a2....ai....an,每个数对应一个坐标(i,ai),对每个坐标与(i,0)做线段,这n个线段哪两个线段与x轴构成的容器装水最多?思路:容器容量由两个线段最短的长度,和底决定。          简单暴力:就是算出两两

2017-10-12 15:51:06 326

转载 c++ vector容器

头文件#include如vector a;  即声明一个int型a[],大小没有固定,可动态增加vector作为参数的三种传参方式:c++中常用的vector容器作为参数时,有三种传参方式,分别如下(为说明问题,用二维vector):function1(std::vectorstd::vectorint> > vec),传值function2(std::vectors

2017-10-12 15:16:57 199

原创 正则表达式匹配(Regular Expression Matching)

https://leetcode.com/problems/regular-expression-matching/description/题目大意:给正则表达式p,一个字符串s,若正则表达式能匹配成功则为true 否则为false,其中‘*’表示*前的字母可重复0或多次,‘.’可以匹配任意字符                 如  ab      a*ab  true

2017-10-10 21:36:19 445

原创 回文数字(Palindrome Number)

https://leetcode.com/problems/palindrome-number/description/题目大意:给一个int型的数字,判断它是不是回文数字思路:首先任意的负数都不是回文           要么把数字转化为字符串           要么把数字翻转(注意翻转后的数字会溢出)  int型取值范围【-2147483648 , 214748364

2017-10-10 15:06:05 1592

转载 python 字符串(string) format介绍和代码

你可以用字符串的format方法来格式化输出字符串。 比如;>>> print 'We are the {0} who say "{1}!"'.format('knights', 'Ni')We are the knights who say "Ni!"括号内的字符(称为格式字段)被替换的对象。{}括号中的数字是指替换的位置,里面的数字,比如0,1表示替换元组的索引位置。

2017-04-03 11:41:20 209

原创 ZigZag Conversion

"PAYPALISHIRING" P A H NA P L S I I GY I RAnd then read line by line: "PAHNAPLSIIGYIR"分析:该题就是给一个字符串,先下写再上写class Solution {public: string convert(string s, int numRows) {

2017-03-14 14:58:32 170

原创 最小生成树 prim算法

#include #include #include #include #include #include #include #include #include #include using namespace std;#define M 0x0f0f0f0fint map[510][510],low[510];int visited[510];int n;int

2014-07-08 16:16:49 237

空空如也

空空如也

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

TA关注的人

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