描述:递归代码: 1 class Solution: 2 # @param num, a list of integers 3 # @return a tree node 4 def sortedArrayToBST(self, num): 5 if len(...
分类:
其他好文 时间:
2014-07-29 16:41:11
阅读次数:
210
1.使用pipeline进行批量导入数据
class Redis_Handler(Handler):
def connect(self):
#print self.host,self.port,self.table
self.conn = Connection(self.host,self.port,self.table)
def execute(self, acti...
分类:
编程语言 时间:
2014-07-29 13:06:56
阅读次数:
394
21点游戏,命令行的,面像过程的写法。ruby 的写法以后再试试。
# this is game 21 point
# 操作命令符 空没有操作,n下一步,抽牌;w亮牌结束;l认输
$ope = ''
$prompt = '>'
$x1 = 0
$x2 = 0
$x3 = 0
$pc = 0
$u1 = 0
$u2 = 0
$u3 = 0
$over = ''
def out_main(a = ...
分类:
其他好文 时间:
2014-07-29 12:52:27
阅读次数:
212
#ifndef __DEF_H__#define __DEF_H__#include #include #include #define TRUE 1#define FALSE 0//任务结构体typedef struct{ void (*thread_function_ptr_) (void...
分类:
编程语言 时间:
2014-07-29 11:34:56
阅读次数:
281
#coding:utf-8importConfigParserclassConf():def__init__(self,name):self.name=nameself.cp=ConfigParser.ConfigParser()self.cp.read(name)defgetSections(se...
分类:
编程语言 时间:
2014-07-29 11:25:16
阅读次数:
290
这是一个循环操作,如果重数太多,只能递归搜索,不满足条件return 或者else,刚才出错了public class Solution { private String letters[] = {"","","abc", "def", "ghi", "jkl", "mno", "pqr...
分类:
其他好文 时间:
2014-07-29 11:08:26
阅读次数:
233
#Card.pyimport randomclass Card: def __init__(self,suit_id,rank_id): self.rank_id = rank_id self.suit_id = suit_id if self.ran...
分类:
其他好文 时间:
2014-07-29 11:04:46
阅读次数:
263
#finalPyPong.pyimport pygame,sysclass MyBallClass(pygame.sprite.Sprite): def __init__(self,image_file,speed,location=[0,0]): pygame.sprite.S...
分类:
编程语言 时间:
2014-07-29 11:02:36
阅读次数:
404
源代码 1 def start(): 2 """ 3 This function calls a function that performs checks on both URL 4 stability and all GET, POST, Cookie and U...
分类:
数据库 时间:
2014-07-29 10:37:46
阅读次数:
422
为了将一个函数的必要参数变为可选参数,需要为这个参数提供一个缺省值 >>>?def?print_lol(the_list,level)????????????#这两个参数都是必要的
>>>?def?print_lol(the_list,level=0)??????...
分类:
编程语言 时间:
2014-07-28 17:01:44
阅读次数:
322