我用的python3,有什么问题吗
def cmp_ignore_case(s1, s2):
l1 = s1.lower()
l2 = s2.lower()
if l1 > l2:
return 1
if l1 < l2:
return -1
return 0
print (sorted(['bob', 'about', 'Zoo', 'Credit'], cmp_ignore_case))
def cmp_ignore_case(s1, s2):
l1 = s1.lower()
l2 = s2.lower()
if l1 > l2:
return 1
if l1 < l2:
return -1
return 0
print (sorted(['bob', 'about', 'Zoo', 'Credit'], cmp_ignore_case))
2017-06-08
举报