码迷,mamicode.com
首页 > 其他好文 > 详细

元祖比较

时间:2019-01-23 23:27:55      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:tuple   lse   tin   and   元祖   print   sdi   als   ==   

s = "Sorting1234"
print("".join(sorted(s, key=lambda x: (x.isdigit(), x.isdigit() and int(x) % 2 == 0, x.isupper(), x.islower(), x))))

sorted通过元祖进行比较

tuple(false,ture)

tuple(ture,false)

后者元祖大

元祖比较

标签:tuple   lse   tin   and   元祖   print   sdi   als   ==   

原文地址:https://www.cnblogs.com/huhuxixi/p/10311816.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!