1 m Queue import Queue 2 from gzip import GzipFile 3 from StringIO import StringIO 4 import time 5 import socket 6 class ContentEncodingProcess...
分类:
编程语言 时间:
2014-07-11 21:41:10
阅读次数:
217
例子import urllib2class RedirctHandler(urllib2.HTTPRedirectHandler):"""docstring for RedirctHandler"""def http_error_301(self, req, fp, code, msg, heade...
分类:
编程语言 时间:
2014-07-08 23:44:41
阅读次数:
584
#coding:utf-8import sys,urllib2,re,Queuesys.path.append("..")from lib.Http_Class import Http_Classfrom BeautifulSoup import BeautifulSoup#############...
分类:
编程语言 时间:
2014-07-07 20:49:39
阅读次数:
350
由于需要从某个网页上下载一些PDF文件,但是需要下载的PDF文件有几百个,所以不可能用人工点击来下载。正好Python有相关的模块,所以写了个程序来进行PDF文件的下载,顺便熟悉了Python的urllib模块和ulrllib2模块。
1、问题描述
需要从http://www.cvpapers.com/cvpr2014.html上下载几百个论文的PDF文件,该网页如下图所示:
2、问...
分类:
编程语言 时间:
2014-07-01 06:58:59
阅读次数:
428
python版本(适用于树莓派) 1 #!/usr/bin/env python 2 #-*-coding:utf-8-*- 3 import httplib,urllib 4 import json 5 import re,urllib2 6 import time 7 8 class Get.....
import urllib2response=urllib2.urlopen('http://house.focus.cn/')html=response.read()print html.decode('gbk')
分类:
编程语言 时间:
2014-06-27 00:50:29
阅读次数:
333
1)使用Package Control组件安装,然后直接在线安装按Ctrl+`调出console粘贴以下代码到底部命令行并回车:import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_...
分类:
其他好文 时间:
2014-06-25 16:38:59
阅读次数:
133
def upload(url,params):
'''
上传文件到服务器,不适合大文件
@params url 你懂的
@params {"action":"xxx","@file","file_path"} 普通参数 key:value 文件key头部加@
'''
import os
import urllib2
BOUNDAR...
分类:
编程语言 时间:
2014-06-25 06:50:59
阅读次数:
298
使用urllib2模块构造http post数据结构,提交有文件的表单(multipart/form-data),本示例提交的post表单带有两个参数及一张图片,代码如下:#buld post body data boundary = '----------%s' % hex(int(...
分类:
编程语言 时间:
2014-06-18 14:55:59
阅读次数:
283
有个视频专门讲过这个爬虫,但是太罗嗦了,顺便整理下,而且到现在,360也不傻,已经进化了,采用原来的方式,多少有点bug,这个后面会说。正题如下:
语言:python2.7.6
模块:urllib,urllib2,re,time
目标:输入任意词,抓到其联想词
版本:w1
原理:在360搜索主页:http://www.so.com/,当你输入”科技“时,搜索框会列出相应的联想词或者短...
分类:
编程语言 时间:
2014-06-14 09:11:06
阅读次数:
1111