摘要:import sysfrom PyQt4.QtCore import *from PyQt4.QtGui import *class Form(QDialog): def __init__(self,parent=None): super(Form,self).__init__(parent) prinlabel=QLabel('Principal: ') ratelabel=QLabel('Rate: ') yearlabel=QLabel('Years: ') amountlabel...
阅读全文
摘要:from __future__ import divisionimport sysfrom math import *from PyQt4.QtCore import *from PyQt4.QtGui import *class Form(QDialog): def __init__(self,parent=None): super(Form,self).__init__(parent) self.browser=QTextBrowser() self.Lineedit=QLineEdit('Type an expression and pre...
阅读全文
摘要:verbose=1def listing(module): if verbose: print '-'*30 print 'name:',module.__name__,'file:',module.__file__ print '-'*30 count=0 for attr in module.__dict__.keys(): print "%02d) %s" % (count,attr) if attr[0:2]=='__': print '' els...
阅读全文
摘要:import time,sysreps=1000size=10000def tester(func,*args): starttime=time.time() for i in range(reps): func(*args) spendtime=time.time()-starttime return spendtimedef forstst(): res=[] for x in range(size): res.append(abs(x))def liststst(): res=[abs(x) for x in rang...
阅读全文
摘要:def min1(args): res=args[0] for arg in args[1:]: if arg<res: res=arg return resdef min2(first,rest): for arg in rest: if arg<first: first=arg return firstdef min3(args): tmp=list(args) tmp.sort() return tmp[0]print 'Please in put a min func...
阅读全文