- 博客(7)
- 收藏
- 关注
原创 python操作数据库获取数据
row = sessinon.execute(sql).ftetchall()取得所有数据,类型是一个list,一行数据算一个tuple.[(),()]为空时判断 row == []row = sessinon.execute(sql).ftetchone()取第一条数据,id_sequence时,取到id较小的那一位。 类型是一个()为空时判断 row is N
2017-03-28 10:08:29 3772
转载 python_单例模式
class Singleton(object): # 定义静态变量实例 __instance = None def __init__(self): pass def __new__(cls, *args, **kwargs): if not cls.__instance:cls.__instance = s
2017-01-16 23:49:27 182
转载 python_super()标准函数
class A(object): def __init__(self): print ("enter A") print ("leave A")class B(object): def __init__(self): print ("enter B") print ("leave B")class C(A): def __init__(self):
2017-01-16 23:41:33 196
转载 python_单例
class Singleton(object): __instance=None def__init__(self): pass def__new__(cls,*args,**kwd): if Singleton.__instance is None: Singleton.__instance=object.__new__(cls,*args,**kwd) return S
2017-01-16 23:40:53 204
原创 栈和队列_迷宫问题_队列
#队列class QueueUnderflow(ValueError): passclass SQueue(): def __init__(self,init_len=8): self._len = init_len self._elems = [0]*init_len self._head = 0 self._
2017-01-02 23:59:43 469
原创 栈和队列_迷宫问题_栈和回朔法
#迷宫问题---栈和队列#继承ValueErrorclass StackUnderflow(ValueError): pass#定义一个栈class SStack(): def __init__(self): self._elems = [] def is_empty(self): return self._elems == []
2017-01-02 21:29:25 320
原创 栈和队列_迷宫问题_递归
#迷宫问题---栈和队列#定义mazeline_0 = [1,1,1,1,1,1,1]line_1 = [1,1,0,1,1,1,1]line_2 = [1,1,0,1,1,1,1]line_3 = [1,1,0,0,0,1,1]line_4 = [1,1,0,1,0,0,1]line_5 = [1,1,0,1,1,1,1]line_6 = [1,1,1,1,1,1,1]maz
2017-01-02 00:56:05 444
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人