Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/TheAlgorithms/Python
/ alphanum_key
Function
alphanum_key
sorts/natural_sort.py:27–28 ·
view source on GitHub ↗
(key)
Source
from the content-addressed store, hash-verified
25
""
"
26
27
def
alphanum_key(key):
28
return
[int(s)
if
s.isdigit()
else
s.lower()
for
s in re.split(
"([0-9]+)"
, key)]
29
30
return
sorted(input_list, key=alphanum_key)
31
Callers
nothing calls this directly
Calls
1
split
Method · 0.80
Tested by
no test coverage detected