Skip to content

Instantly share code, notes, and snippets.

@chuongmep
Created October 19, 2020 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuongmep/76c2069309899173f53f6a0bb9a5c4d2 to your computer and use it in GitHub Desktop.
Save chuongmep/76c2069309899173f53f6a0bb9a5c4d2 to your computer and use it in GitHub Desktop.
import re
def sort(x):
convertText = lambda text: int(text) if text.isdigit() else text.lower()
Textkey = lambda key: [ convertText(c) for c in re.split('([0-9]+)', key) ]
return sorted(x, key = Textkey)
OUT = sort(IN[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment