We essentailly do an in-order traversal (中序遍历) of the tree since the in-order traversal results in a sorted list of node items.1 def traverse_binary_t...
分类:
其他好文 时间:
2015-02-26 06:28:30
阅读次数:
155
#!/usr/bin/env?python
#coding:?utf-8
import?md5
import?os
from?time?import?clock?as?now
def?getmd5(filename):
????file_txt?=?open(filename,?‘rb‘).read()
????m?=?md5.new(f...
分类:
编程语言 时间:
2015-02-25 22:27:09
阅读次数:
403
#coding=gbk import osimport httplib2import socket def GetWebStatus(host): try: h =httplib2.Http() resp, content = h.requ...
分类:
Web程序 时间:
2015-02-25 17:00:33
阅读次数:
116
自定义错误页面views.py@app.errorhandler(404)def internal_error(error): return render_template('error.html',errorcode = 404, errormsg = 'page not found')@a...
分类:
其他好文 时间:
2015-02-25 15:22:17
阅读次数:
168
def permutate(s): if not s: return [s] r = [] for i in range(len(s)): for m in permutate(s[:i] + s[i+1:]): r.append(s[i:i+1] + m) return r
分类:
其他好文 时间:
2015-02-25 15:21:42
阅读次数:
102
fromPyQt4importQtCorefromPyQt4importQtGuiclassSimpleListModel(QtCore.QAbstractListModel):def__init__(self,contents):super(SimpleListModel,self).__init...
分类:
其他好文 时间:
2015-02-24 21:00:34
阅读次数:
311
Python下的主窗口可以定义如下:def start(self): #self.project = Project("temp") #self.project.directory = os.getcwd() #Splash = SplashScreen(self.master) self.hell...
分类:
编程语言 时间:
2015-02-23 16:40:07
阅读次数:
190
进入STARS后,最简单的学习方法就是演示示例数据。对于源码的分析也可以从这里入手。以下为出发菜单项“Example Project”的函数example:def example(self): """canned loading of data files and matrices for debu...
分类:
编程语言 时间:
2015-02-23 16:39:59
阅读次数:
317
importsysimportosfromPyQt4importQtCore,QtGuifromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*classasset(QtGui.QDialog):def__init__(self,parent=None):super...
分类:
其他好文 时间:
2015-02-21 15:29:02
阅读次数:
366
#-*-coding:utf-8-*-__author__='Administrator'fromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*importsysimporttimeclassMyWindow(QWidget):def__init__(self,*...
分类:
其他好文 时间:
2015-02-21 15:28:01
阅读次数:
167