代码如下: 1 import re 2 import urllib.request 3 import urllib 4 import time 5 6 from collections import deque 7 8 head = { 9 'Connection': 'Keep-Al...
分类:
编程语言 时间:
2015-09-12 12:12:03
阅读次数:
360
Avoid Whack-a- Mole DevelopmentVenkat Subramaniam Broomfield, Colorado, U.S.SoFTWARE PRojECT MAnAgERS face a lot of pressure to deliver fast. Time is of the essence. How can you get things done fast?...
分类:
其他好文 时间:
2015-09-11 10:47:13
阅读次数:
151
今天开始学习Python写个爬虫。首先,从百度找个实例来看看。1importurllib.request,re,sys,os2defget_bing_backphoto():3if(os.path.exists('photos')==False):4os.mkdir('photos')5foriin...
分类:
编程语言 时间:
2015-09-10 11:03:12
阅读次数:
220
Getting Started with Blocks(开始block) The following sections help you to get started with blocks using practical examples.
分类:
移动开发 时间:
2015-09-09 11:27:27
阅读次数:
240
#!/usr/bin/envpython
#coding=utf-8
‘‘‘
@这个脚本会显示除urls列表中定义的网页的header,在请求时,会随机使用已经定义好的my_headers列表中的User-Agent
并且在最后使用chardet模块,显示出此网页使用的编码
‘‘‘
importurllib2
importrandom
importchardet
urls=[‘htt..
分类:
编程语言 时间:
2015-09-08 16:52:55
阅读次数:
179
#!/usr/bin/envpython
#coding=utf-8
‘‘‘
@这个脚本会将指定网页中的壁纸图片下载到本地
‘‘‘
importurllib
importre
defget_html_info(url):
‘‘‘@获取网页源代码‘‘‘
html=urllib.urlopen(url)
html_info=html.read()
returnhtml_info
defget_img(info):
‘‘‘@获取通过正则表..
分类:
编程语言 时间:
2015-09-08 15:36:21
阅读次数:
229
1.urllib2.urlopen(request)url="http://www.baidu.com"
#url还可以是其他协议的路径,比如ftp
values={‘name‘:‘MichaelFoord‘,‘location‘:‘Northampton‘,language‘:‘Python‘}
data=urllib.urlencode(values)
user_agent=‘Mozilla/4.0(compatible;MSIE5.5;WindowsNT)‘
header..
分类:
编程语言 时间:
2015-09-08 07:12:01
阅读次数:
259
任务:需要获取的内容:廖雪峰的官方网站中的python部分的标题和内容,之后获取整个python教程的内容,而不仅仅是这一个页面:http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000 对h...
分类:
编程语言 时间:
2015-09-06 21:22:28
阅读次数:
270
一、使用正则表达式实现爬虫: Import requests,re 获取网页源码:htmlsource=requests.get(url).text 使用正则表达式匹配网页中的内容: Re模块常用的函数 Re.findall(pattern,string,flags=0) #返回内容为包含匹配结果的...
分类:
编程语言 时间:
2015-09-06 20:06:56
阅读次数:
212
原文链接:http://www.pythonclub.org/python-network-application/observer-spider 原文的名称虽然用了《用python爬虫抓站的一些技巧总结》但是,这些技巧不仅仅只有使用python的开发可以借鉴,我看到这篇文章的时候也在回忆自己...
分类:
编程语言 时间:
2015-09-03 23:25:37
阅读次数:
617