快排,取一个key值,一般取第一个即可,将小于key的放到左边,大于key的放到右边,递归实现 1 import random 2 def quicksort(data, low = 0, high = None): 3 if high == None: 4 high = l...
分类:
编程语言 时间:
2014-09-03 12:48:36
阅读次数:
343
在Scala中函数和方法有什么区别 方法可以作为一个表达式的一部分出现(调用函数并传参),但是方法(带参方法)不能作为最终的表达式, 但是函数可以作为最终的表达式出现: scala> //定义一个方法scala> def m(x:Int) = 2*xm: (x: Int)Intscala> //定义...
分类:
其他好文 时间:
2014-09-03 11:04:16
阅读次数:
270
1. lambdaThe lambda operator or lambda function is a way to create small anonymous functions ,i.e. functions without a name. 可以方便的创造一个函数。比如 def add(.....
分类:
编程语言 时间:
2014-09-02 14:09:04
阅读次数:
182
使用Python自带编辑器python IDLE的语法提示功能的配置1.C:\Python27\Lib\idlelib\config-extensions.def文件编辑[AutoComplete]enable=1popupwait=2000(改为0,语法提示等待时间)2.C:\Python27\L...
分类:
编程语言 时间:
2014-09-02 14:07:14
阅读次数:
308
闲言少述,直接上代码
??
?#!/usr/bin/env python
#
#
?
import json
import getopt, sys
def usage():
print sys.argv[0] + ' -i irt -s status'
print sys.argv[0] + ' -i irt -n seg -t stime'
pr...
分类:
编程语言 时间:
2014-09-02 12:24:54
阅读次数:
149
写完之后各种调试各种TLE,第二天早上整理了下思路,重写了一遍,立马AC了;具体见注释
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#def...
分类:
其他好文 时间:
2014-09-02 12:24:44
阅读次数:
147
1、Replicator运行代码具体分析上篇问中介绍了启动Replicator的详细过程,以下解说Replicator的运行代码的详细实现,首先看replicate方法:def replicate(self, override_devices=None, override_partitions=No...
分类:
编程语言 时间:
2014-09-02 11:53:54
阅读次数:
244
如果你在迭代里有一个条件,而这个条件需要查数据表来获得结果。那么请添加一个方法,比如:def checked?
分类:
其他好文 时间:
2014-09-01 21:00:33
阅读次数:
190
1.使用pipeline进行批量导入数据。包含先使用rpush插入数据,然后使用expire改动过期时间class Redis_Handler(Handler): def connect(self): #print self.host,self.port,self.table self.conn.....
分类:
编程语言 时间:
2014-09-01 19:11:53
阅读次数:
322
下面是递归遍历、获取树节点的方法。 1 def getTreeAllText(self): 2 '''获取树控件的全部文本''' 3 result = [] 4 treeRoot = self.treeCtrl.GetRootItem() 5 ...
分类:
编程语言 时间:
2014-09-01 17:20:43
阅读次数:
183