18 lines
470 B
Python
18 lines
470 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)
|
||
]
|
||
|
||
|
||
def get_priority(text: str) -> (int, str):
|
||
if re.search('[а-яё]', text, flags=re.IGNORECASE):
|
||
return 2, text
|
||
|
||
if re.search('[a-z]', text, flags=re.IGNORECASE):
|
||
return 3, text
|