![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python3
AdaWong_Corner
another blog address: http://www.cnblogs.com/adawong/
展开
-
sort data using Python3
list.sort() 与 sorted() 的比较Python列表具有内置的list.sort()方法,可以原位修改列表。 python的内置函数sorted() 则可将一个可迭代对象(iterable)构建成一个新的排序列表。 通常较多的使用sorted() ,但是如果用户不需要原始列表,那么则可以考虑使用list.sort(),因为它的效率稍微高于sorted() 。iterable主要包原创 2017-11-01 14:40:09 · 400 阅读 · 0 评论 -
AttributeError: 'dict' object has no attribute 'has_key'
AttributeError: ‘dict’ object has no attribute ‘has_key’Python 3 已弃用 has_key 这一方法错误代码:ssCnt = {} if not ssCnt.has_key(can): ssCnt[can]=1 else: ssCnt[can] += 1修正后:ssCnt = {} if can not in ssCnt: ssCnt[c翻译 2017-11-01 18:34:29 · 13854 阅读 · 2 评论