Last active
December 9, 2017 19:37
-
-
Save teionn/9e670368fabd5c8fefd53a2e36290dd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from collections import OrderedDict | |
def sortedStringList(array=[]): | |
sortDict=OrderedDict() | |
for splitList in array: | |
sortDict.update({splitList:[int(x) for x in re.split("(\d+)",splitList)if bool(re.match("\d*",x).group())]}) | |
return [sortObjKey for sortObjKey,sortObjValue in sorted(sortDict.items(), key=lambda x:x[1])] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getList=["test_20_geo","test_100_geo","test_001_geo","test_10_geo","test_011_geo","test_2_geo"] | |
print sortedStringList(getList) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment