Python
ziven2012
这个作者很懒,什么都没留下…
展开
-
python算法实现系列-堆排序
最近在学习排序算法,正好打算练习一下自己前段时间自学的python基础,就用python来实现这些算法。 本文实现堆(大顶堆)排序,代码如下:def heap_adjust(data, s, m): temp = data[s] j = 2 * s + 1 while j < m: if j < m - 1 and data[j] <原创 2014-03-18 15:52:13 · 2220 阅读 · 0 评论 -
python算法实现系列-归并排序
效率比较高的归并排序, 有两种方式。1.使用递归def merge(left, right): result = [] i,j = 0, 0 while i < len(left) and j < len(right): if left[i] < right[j]: result.append(left[i])原创 2014-03-19 15:35:20 · 870 阅读 · 0 评论 -
python框架Scrapy报错TypeError: 'float' object is not iterable解决
最近在学习使用python的Scrapy爬虫框架练习爬取网站,在爬取的时候总是执行失败,具体错误如下:2017-03-09 13:58:34 [scrapy] INFO: Enabled item pipelines:[]2017-03-09 13:58:34 [scrapy] INFO: Spider opened2017-03-09 13:58:34 [scrapy] INFO: Craw原创 2017-03-09 14:22:37 · 13789 阅读 · 2 评论 -
pip install时报错TypeError: __call__() missing 1 required positional argument: 'name'解决
最近在Ubuntu14.04使用pip3安装软件包的时候出现了如下错误:TypeError: __call__() missing 1 required positional argument: 'name',原创 2017-05-22 09:29:48 · 13004 阅读 · 0 评论