
python
文章平均质量分 62
Will Cui
这个作者很懒,什么都没留下…
展开
-
量化交易学习
每天积累一点原创 2023-11-21 17:03:31 · 225 阅读 · 0 评论 -
Python Http请求
#!-*-coding=UTF-8-*-import urllibimport urllib2file=open('d:\diagnose_info.txt','r')guiyi=open('d:\data\guiyi.txt','a')num=0for i in file.readlines(): try: url= 'http://172.16.124.20:8188/no原创 2017-02-10 11:39:49 · 552 阅读 · 0 评论 -
Python 爬虫
一,获取整个页面数据 首先我们可以先获取要下载图片的整个页面信息。getjpg.py#coding=utf-8import urllibdef getHtml(url): page = urllib.urlopen(url) html = page.read() return htmlhtml = getHtml("http://tieba.baidu.com/p原创 2017-02-10 11:39:32 · 286 阅读 · 0 评论 -
Python 爬虫
一,获取整个页面数据 首先我们可以先获取要下载图片的整个页面信息。getjpg.py#coding=utf-8import urllibdef getHtml(url): page = urllib.urlopen(url) html = page.read() return htmlhtml = getHtml("http://tieba.baidu.com/p原创 2017-02-10 11:39:29 · 301 阅读 · 0 评论 -
python hbase thrift
创建hbase表:from thrift import Thriftfrom thrift.transport import TSocketfrom thrift.transport import TTransportfrom thrift.protocol import TBinaryProtocol from hbase import Hbasefrom hbase.ttypes impor原创 2017-02-10 11:39:08 · 323 阅读 · 0 评论 -
Python thrift
# Building Apache Thrift on CentOS 6.5 2 3 Starting with a minimal installation, the following steps are required to build Apache Thrift on Centos 6.5. This example builds from source, using the原创 2017-02-10 11:39:01 · 478 阅读 · 0 评论 -
python 多进程
众所周知,python本身是单线程的,python中的线程处理是由python解释器分配时间片的;但在python 3.0中吸收了开源模块,开始支持系统原生的进程处理——multiprocessing.注意:这个模块的某些函数需要操作系统的支持,例如,multiprocessing.synchronize模块在某些平台上引入时会激发一个ImportError1)Process 要创建一个Proc原创 2017-02-10 11:38:58 · 403 阅读 · 0 评论 -
tornado 提示缺失zlib
使用./configure --with-zlib 重新编译make make instal原创 2017-02-10 11:38:44 · 493 阅读 · 0 评论 -
CX_ORACLE SESSIONPOOL
import cx_OracleoraPool=cx_Oracle.SessionPool(user='crystal',password='crystal',dsn='10.14.250.29/oratest',min=1,max=500,increment=1)def oraConn(oraSql): conn=oraPool.acquire() cursor=conn.curso原创 2017-02-10 11:37:13 · 2503 阅读 · 0 评论 -
Python 多进程
由于要做把一个多线程改成多进程,看一下相关方面的东西,总结一下,主要是以下几个相关的标准库subprocesssignalthreadingmultiprocessingmutilprocess简介像线程一样管理进程,这个是mutilprocess的核心,他与threading很是相像,对多核CPU的利用率会比threading好的多。简单的创建进程import multiprocessing原创 2017-02-10 11:37:11 · 284 阅读 · 0 评论 -
Python Time List
import datetimeStartDay=datetime.date(2014,01,31)EndDay=datetime.date.today()OneDay=datetime.timedelta(days=1)while StartDay StartDay+=OneDay print 'P'+''.join(str(StartDay).split('-'))原创 2017-02-10 11:36:22 · 649 阅读 · 0 评论 -
Python Times
DateTime模块 >>> import datetime>>> d1 = datetime.datetime(2005, 2, 16)>>> d2 = datetime.datetime(2004, 12, 31)>>> (d1 - d2).days47上例演示了计算两个日期相差天数的计算。import datetimestarttime = datetime.datetime.now()#l原创 2017-02-10 11:36:19 · 600 阅读 · 0 评论 -
Python 工厂函数
abs() : 取绝对值: >>> abs(-1) >>1coerce(): 数据类型转换函数 :>>> coerce(1, 2) >>(1, 2) ;>>> coerce(1.3, 134L) >> (1.3, 134.0)divmod(): 内原创 2017-02-10 11:34:27 · 439 阅读 · 0 评论 -
Python & Excel
python操作Excel读写--使用xlrd一、安装xlrd模块 到python官网下载http://pypi.python.org/pypi/xlrd模块安装,前提是已经安装了python 环境。二、使用介绍 1、导入模块 import xlrd 2、打开Excel文件读取数据 data = xlrd.open_workbook('excelFile.xls')原创 2017-02-10 11:34:21 · 244 阅读 · 0 评论 -
Python Time
Python提供了多个内置模块用于操作日期时间,像calendar,time,datetime。time模块我在之前的文章已经有所介绍,它提供的接口与C标准库time.h基本一致。相比于time模块,datetime模块的接口则更直观、更容易调用。今天就来讲讲datetime模块。 datetime模块定义了两个常量:datetime.MINYEAR和datetime.MAXYEAR,分原创 2017-02-10 11:34:18 · 176 阅读 · 0 评论 -
Python Mail
import smtplibfrom email.mime.text import MIMETextmailto_list=[#mail_list]mail_host="smtp.*.com"mail_user=usernamemail_pass=passwdmail_postfix="*.com"def send_mail(to_list,sub,context): me = ma原创 2017-02-10 11:34:15 · 285 阅读 · 0 评论 -
Python MySQLdb
Error:import error:libmysqlclient.so.18 :cannot open shared object file:No such file or directorysolutions: First:find where is libmysqlclient.so.18 second: ln -s full path /usr/lib/lib原创 2017-02-10 11:33:44 · 354 阅读 · 0 评论