We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bc178bc commit 3174f35Copy full SHA for 3174f35
scripts/update_readme.py
@@ -70,15 +70,12 @@ def load_problems_cache():
70
71
def extract_problem_number(file_name: str) -> int | None:
72
"""Извлекает номер задачи из имени файла."""
73
- if not file_name.endswith('.py') or not file_name[:-3].replace('_', '').isdigit():
74
- return None
75
- parts = file_name[:-3].split('_')
76
- if not parts:
77
78
- try:
79
- return int(parts[-1])
80
- except ValueError:
+ if not file_name.endswith('.py'):
81
return None
+ match = re.search(r'(\d+)(?=_*\.py$)', file_name)
+ if match:
+ return int(match.group(1))
+ return None
82
83
84
def main():
solutions/two_sum_0001.py
0 commit comments