为什么输出错误?

来源:2-7 python中自定义排序函数

南飞雁ht

2018-01-02 21:24

def cmp_ignore_case(s1, s2):

    x1=s1.lower

    x2=s2.lower

    if x1<x2:

        return -1

    if x1>x2:

        return 1

    return 0


print sorted(['bob', 'about', 'Zoo', 'Credit'], cmp_ignore_case)


写回答 关注

2回答

python进阶

学习函数式、模块和面向对象编程,掌握Python高级程序设计

255495 学习 · 3038 问题

查看课程