Skip to content

Instantly share code, notes, and snippets.

@roccogalluzzo
Created January 23, 2010 23:13
Show Gist options
  • Save roccogalluzzo/284845 to your computer and use it in GitHub Desktop.
Save roccogalluzzo/284845 to your computer and use it in GitHub Desktop.
def ascii_sorting(l)
convert = lambda text: int(text) if text.isdigit() else text
ascii_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
return sorted(l, key=ascii_key )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment