标签:arc lis key 字符串 eve 排序 color group rev
#coding:utf-8 import re s = [‘dat2‘,‘dat10‘,‘dat5‘] #方法一 new = sorted(s,key = lambda i:int(re.search(r‘(\d+)‘,i).group())) print new #方法二 s.sort(key=lambda i:int(re.search(‘(\d+)‘, i).group())) print s
sorted(iterable, cmp=None, key=None, reverse=False)
sort(cmp=None, key=None, reverse=False)
标签:arc lis key 字符串 eve 排序 color group rev
原文地址:https://www.cnblogs.com/liuliu-word/p/8931172.html