|
|
|
|
|
by solaxun
3707 days ago
|
|
Pass in an re.match or re.search based function, i would imagine that would be powerful enough to meet most needs. import re x = ['foo12901','fooo900','fooooooo980090'] x =sorted(x,key = lambdax:int(re.search('\d+',x).group())) print(x) |
|