Python3中sorted函数没有cmp关键字
2015-04-15 09:26
337 查看
Python3中sorted函数没有cmp关键字
Python3中去除了cmp内置函数,同时sorted等函数也去除了cmp关键字,添加key关键字cmp函数到key函数的转换为functools.cmp_to_key。
if sys.version_info[0] == 3: qs1 = sorted(qs, key=functools.cmp_to_key(sort_status_uniqid)) else: qs1 = sorted(qs, cmp=sort_status_uniqid)
相关文章推荐
- python sorted()函数cmp,key,reverse参数详解
- python sorted()函数
- Python---函数---关键字参数
- python sorted()函数用法
- 【转】python中List的sort方法(或者sorted内建函数)的用法
- python2,3中内建函数map,reduce,filter,sorted配合lambda
- python:内建函数、range()、map()、filter()、reduce()、sorted()、集合的使用、functools中的函数使用、MD5加密
- python函数中输入关键字参数——字典参数,怎么样按输入的顺序输出
- python函数三个知识点,一般书上没有讲。
- python3 sort sorted 函数应用
- python嵌入C++------ boost.python如何在C++中调用含有不定长参数tuple变量和关键字参数dict变量的函数
- python(sorted()函数)
- 【Python-3.3】函数中的可变参数和关键字参数
- Python3:sorted()函数及列表中的sort()函数
- Python笔记-函数定义、默认参数、关键字参数、参数组合
- python中List的sort方法(或者sorted内建函数)的用法
- python:内建函数、range()、map()、filter()、reduce()、sorted()、集合的使用、functools中的函数使用、MD5加密
- python常用函数之lambda、reduce、map、sorted、filter
- 【python】函数+windows下文件路径的\ / 问题(一个创建文件并过滤关键字的例子)
- PYthon投票程序段以及sorted函数说明