![]() |
|
|
+ Search |
![]()
|
Feb 15th, 2004 10:02
Washington Corrêa, Sam G,
Here it goes a function that can sort this list:
def sortIt(l):
p = lambda s: s.strip('.txt').split('.') + [s]
h = lambda x: [int(x[0]), int(x[1]), x[2]]
l = map(h, map(p, l))
l.sort()
return map(lambda k: k[2], l)
Example:
m = ['1.8.txt', '1.2.txt', '1.9.txt', '1.10.txt']
print sortIt(m)
ok?
Junior