python list 字符串排序
#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)