1.Unpack the tuple

2.split the string through "str"
str.split(str="", num=string.count(str))
3.split by filename and path

4.sort the filename

a = ['10.png','2.png','12.png','1.png']
a.sort(key=lambda x:int(x[:-4]))
print(a)
1.Unpack the tuple

2.split the string through "str"
str.split(str="", num=string.count(str))
3.split by filename and path

4.sort the filename

a = ['10.png','2.png','12.png','1.png']
a.sort(key=lambda x:int(x[:-4]))
print(a)
116
1163
1335
242

被折叠的 条评论
为什么被折叠?