Skip to content

Instantly share code, notes, and snippets.

@chuongmep

chuongmep/sort.py

Created Oct 19, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.