自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(186)
  • 资源 (1)
  • 收藏
  • 关注

原创 spider小白-初探Scrapy

Scrapy框架可以帮我们处理一部分事情,从而减轻我们的负担。更重要的是,Scrapy框架使用了异步的模式可以加快下载速度,而自己手动实现异步模式是十分麻烦的事情。Scrapy框架的安装就不提了,下面演示怎么生产Scrapy项目。 然后使用pycharm打开生成的项目zhilianproject,工程目录如下: 其中myRedisCommand.py mySqlCommand.py zh

2017-11-12 22:38:10 490

原创 Jenkins实现自动构建

公司之前的代码管理只是使用svn,老是出现几个人提交代码然后导致代码库里的代码出错,而且大家都不知道,依然继续提交。。。 这个实在是太愚蠢,难以控制,容易出错Jenkins就是为了应对这种情况而生的好东西,它可以对代码定时进行自动构建,当代码更新时进行自动构建,一旦构建失败还可以发邮件等形式通知代码提交者,是提高效率的利器。Jenkins的搭建并不难,参考:http://blog.

2017-09-14 09:57:06 685

原创 python-微博模拟登录

相比于上一篇知乎模拟登录,本篇的微博模拟登录则更为复杂一些。打开firefox的开发者模式,清楚相关网站的cookies,以防因为某些重要文件已经被缓存,而观察不到相应的HTTP交互。进行微博登录,观察HTTP交互状况,以下将对过程进行分析:第一步:预登录 现在很多网站都会进行预登录,对输入的用户名进行编码或者加密处理。 该请求对应的响应为: sinaSSOController.pre

2017-09-07 15:25:57 5199 1

原创 python-知乎模拟登录

本篇文章用于记录如何实现知乎模拟登录本篇采用firefox浏览器,按F12开发者工具来进行HTTP交互的获取和分析。需要设置开发者工具中的preserve log选项,否则会因为HTTP交互过多,无法参考中间过程的HTTP请求和回应登录知乎,通过开发者工具来查看HTTP交互,发现实际的登录地址为https://www.zhihu.com/login/email. 这是我们使用email进行登录,如果

2017-09-04 15:22:46 1993

原创 Python的重要课题的学习连接

python的生成器和yield的详细介绍:http://www.jb51.net/article/59671.htmpython协程以及异步IO:http://python.jobbole.com/87202/

2017-08-14 15:14:15 442

原创 Leetcode Word Ladder II

Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) frombeginWord to endWord, such that:Only one letter can be changed at a timeEa

2017-07-26 10:40:44 226

转载 python爬虫-多进程

python当中因为一个进程同一时刻只能执行一个线程,所以多线程效率并不高,要提高效率需要使用多进程。Process([group [, target [, name [, args [, kwargs]]]]])target表示调用对象,你可以传入方法的名字args表示被调用对象的位置参数元组,比如target是函数a,他有两个参数m,n,那么args就传入(m, n)即

2017-07-21 16:27:33 401

转载 python爬虫-正则表达式

正则表达式是十分高效而优美的匹配字符串工具,一定要好好掌握。利用正则表达式可以轻易地从返回的页面中提取出我们想要的内容。1)贪婪模式与非贪婪模式python默认是贪婪模式。贪婪模式,总是尝试匹配尽可能多的字符;非贪婪模式,总是尝试尽可能少的字符。一般采用非贪婪模式来提取。2)反斜杠问题正则表达式里使用"\"作为转义字符,这会造成困扰。如果你要匹配文中的字符"\"

2017-07-21 11:34:42 250

转载 python爬虫利器-request库

request库比urllib2库更为高级,因为其功能更强大,更易于使用。使用该库可以十分方便我们的抓取。基本请求r = requests.get('http://cuiqingcai.com')r = requests.post("http://httpbin.org/post")r = requests.put("http://httpbin.org/put")r =

2017-07-21 09:50:14 290

转载 python爬虫-cookie

Cookie指某些网站为了辨别用户身份,进行session跟踪而存储在用户本地终端上的数据(经过加密)。例如:网站的某些页面必须登录后才可以抓取,但你通过urllib2库保存我们登录该网站的Cookie,就可以对该页面进行抓取。cookielib提供可存储cookie的对象,通过本模块的CookieJar类的对象来捕获cookie并在后续连接请求是重新发送。1)抓取Co

2017-07-21 09:01:03 195

转载 python爬虫-异常处理

主要有两类异常 :URLError和HTTPErrorURLError:该异常发生的情况:1.网络无法连接2.连接不到特定服务器3.服务器不存在import urllib2 requset = urllib2.Request('http://www.xxxxx.com')try: urllib2.urlopen(request)except urll

2017-07-20 16:56:16 279

转载 Python爬虫-urllib库

通过构建一个request请求发送,然后获取回应response,也就是网页代码import urllib2request = urllib2.Request("www.baidu.com")response = urllib2.urlopen(request)pageCode = response.read().decode('gbk')数据传送分为两种方式:GE

2017-07-20 16:34:04 225

原创 Leetcode Surrounded Regions

Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into'X's in that surrounded region.For example,X X

2017-07-18 17:27:00 155

原创 Leetcode Word Ladder

Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence frombeginWord to endWord, such that:Only one letter can be changed at a

2017-07-17 18:28:54 183

原创 Leetcode Palindrome Partitioning II

Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs.For example, given s = "aab",Return 1

2017-07-17 14:55:01 150

原创 Leetcode Candy

There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least on

2017-07-17 11:18:34 233

原创 Leetcode gasstation

There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to it

2017-07-16 12:03:13 217

原创 Leetcode Max Points on a Line

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.暴力破解,通过记录hash方法来进行记录中间结果,代码如下:/** * Definition for a point. * struct Point { * int x

2017-07-14 15:20:02 171

原创 Leetcode Word Break II

Given a non-empty string s and a dictionarywordDict containing a list of non-empty words, add spaces ins to construct a sentence where each word is a valid dictionary word. You may assume the dict

2017-07-13 09:47:21 391

原创 Leetcode LRU Cache

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.get(key) - Get the value (will always be positive) of the key i

2017-07-13 08:54:31 277

原创 Leetcode Word Break

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. You may as

2017-07-12 19:43:00 153

原创 Leetcode Evaluate Reverse Polish Notation

Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are +, -,*, /. Each operand may be an integer or another expression.Some examples: ["2", "1", "+",

2017-07-12 14:19:48 191

原创 Leetcode Sort List

Sort a linked list in O(n log n) time using constant space complexity.本题使用归并算法,但需要注意的是归并的终结条件。终结条件为head==NULL以及head->next==NULL,因为这两种情况下,程序都不会自动结束。代码如下:/** * Definition for singly-l

2017-07-12 10:24:38 166

原创 Leetcode Insertion Sort List

Sort a linked list using insertion sort.思路就跟数组的插入排序思想一致,但是因为链表的只能从前往后遍历且无法随机访问,所以操作比较复杂,需要小心处理。代码如下:/** * Definition for singly-linked list. * struct ListNode { * int val; * Li

2017-07-11 15:28:40 178

原创 Leetcode Binary Tree Postorder Traversal

Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recursive solution is tri

2017-07-11 13:51:34 157

原创 Leetcode Binary Tree Preorder Traversal

Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive solution is triv

2017-07-11 10:41:56 179

原创 Leetcode Reorder List

Given a singly linked list L: L0?L1?…?Ln-1?Ln,reorder it to: L0?Ln?L1?Ln-1?L2?Ln-2?…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it to {1,4

2017-07-11 10:05:22 156

原创 Leetcode Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Note: Do not modify the linked list.Follow up:Can you solve it without using extra space?

2017-07-10 16:55:43 159

原创 Leetcode Linked List Cycle

Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?解题思路:分别设置两个指针one和two,遍历的时候,one=one->next,two=two->next->next,这样以不同速率进行遍历,如果该列表存在环的

2017-07-10 15:59:22 178

原创 Leetcode Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.最先想到就是遍历列表生成新的列表,但没有对random域进行

2017-07-10 15:22:16 168

原创 Leetcode Single Number II

Given an array of integers, every element appearsthree times except for one, which appears exactly once. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could y

2017-07-10 14:11:48 165

原创 Leetcode Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return[ ["aa","b"],

2017-07-07 10:25:57 202

原创 Leetcode Single Number

Given an array of integers, every element appearstwice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extr

2017-07-07 08:58:00 217

原创 Leetcode Longest Consecutive Sequence

Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3,

2017-07-07 08:40:08 258

原创 Leetcode Populating Next Right Pointers in Each Node II

Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extr

2017-07-06 16:17:29 142

原创 Leetcode Sum Root to Leaf Numbers

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number123.Find the total s

2017-07-06 15:19:06 172

原创 Leetcode Binary Tree Maximum Path Sum

Given a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The pa

2017-07-06 09:39:33 152

原创 Leetcode Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a pa

2017-07-05 16:23:40 131

原创 Leetcode Best Time to Buy and Sell Stock II

Say you have an array for which the ith element is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one

2017-07-05 14:39:17 129

原创 Leetcode Triangle

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [6,

2017-07-05 14:02:49 126

《机qi学习shi战.pdf》高清中文版PDF+英文版PDF+源代码.zip

用于机器学习入门的资料 跟着源代码学习 一步一步掌握

2019-06-11

空空如也

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

TA关注的人

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