package controllerimport urllib.request,os; pf = 'PackageControl.sublime-package'; ipp = sublime.installed_packages_path();urllib.request.install_open...
分类:
其他好文 时间:
2015-09-13 23:02:38
阅读次数:
171
代码如下: 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
#!/usr/bin/python3import timeimport pymssqlimport urllib.parseimport httplib2import os.pathimport xml.etree.ElementTreeimport cx_Oraclev_curr_datetime...
分类:
数据库 时间:
2015-09-11 12:41:03
阅读次数:
241
import?urllib
import?string
import?re
def?getHtml(url):
page=urllib.urlopen(url)
html=page.read()
return?html
def?getPic(html):
imgre=re.compile(r‘src=".+?\.jpg"?data-big-img‘)
imglist...
分类:
编程语言 时间:
2015-09-09 17:45:55
阅读次数:
200
import urllibimport urllib.requestimport osfrom bs4 import BeautifulSoupimport http.cookiejarimport recj = http.cookiejar.CookieJar()opener = urllib.r...
分类:
编程语言 时间:
2015-09-09 16:48:07
阅读次数:
825
ORM:就是类似于Django的models,我们可以不用SQL语句去操作数据库;只需要操作对象的属性和方法。先安装peewee,我是在Ubuntu的环境下:sudo pip install peewee(1)urllib 模块(2)@property的使用:把方法变为属性,前端页面可以直接调用(t...
分类:
编程语言 时间:
2015-09-09 13:19:59
阅读次数:
331
#!/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
问题背景:指定爬虫depth、线程数, python实现并行爬虫 思路: 单线程 实现爬虫类Fetcher 多线程 threading.Thread去调Fetcher 方法:Fetcher 中,用urllib.urlopen打开指定url,读取信息:response = urllib.urlopen(self.url)
content = respon...
分类:
编程语言 时间:
2015-09-07 22:55:23
阅读次数:
248
Python官方提供了用于编写网络爬虫的包 urllib.request, 我们主要用它进行打开url,读取url里面的内容,下载里面的图片。分以下几步:step1:用urllib.request.urlopen打开目标网站step2:由于urllib.request.urlopen返回的是一个ht...
分类:
编程语言 时间:
2015-09-03 23:18:09
阅读次数:
466