Created
December 13, 2022 13:21
-
-
Save minhoryang/791fca9fa5c634bdf470b9bf24be1ca7 to your computer and use it in GitHub Desktop.
sortkey_natural natual/human sort
This file contains hidden or 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
def sortkey_natural(s): | |
return tuple( | |
int(part) if re.match(r'[0-9]+$', part) else part | |
for part in re.split(r'([0-9]+)', s) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/SethMMorton/natsort