2013年11月25日

摘要: 【总结】优化python程序的流程(自顶向下):1.先用cProfile找出最耗时的函数,2.然后在这个函数前面加@profile 用line_profiler(+kernprof)找出最耗时的行,3.最后用timeit测试下这个行的运行效率。下面是具体介绍各个部分:----------------... 阅读全文
posted @ 2013-11-25 19:46 江小鱼2015 阅读(216) 评论(0) 推荐(0) 编辑
摘要: from heapq import heappop,heappusha = [1,3,5,7,2,34,0,2]heap = []for i in a: heappush(heap,i)for x in range(len(a)): print heappop(heap) ... 阅读全文
posted @ 2013-11-25 19:31 江小鱼2015 阅读(181) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/FengYan/archive/2012/05/06/2480664.html#Ver1.0#Zero @2012.5.2#import mathimport randomimport cPickle as pickle#calculate the ov... 阅读全文
posted @ 2013-11-25 09:58 江小鱼2015 阅读(219) 评论(0) 推荐(0) 编辑

导航