9 lines
258 B
Python
9 lines
258 B
Python
import re
|
|
|
|
|
|
def natural_sort_key(s):
|
|
"""Функция для получения ключа для натуральной сортировки."""
|
|
return [
|
|
int(text) if text.isdigit() else text.lower() for text in re.split(r"(\d+)", s)
|
|
]
|