diff --git a/HackathonBot/utils.py b/HackathonBot/utils.py index 85774fb..f0a97d9 100644 --- a/HackathonBot/utils.py +++ b/HackathonBot/utils.py @@ -98,12 +98,13 @@ def process_issue(task_text, config): """ task_list = [] for i in range(config['max_task_id']): - start = task_text.find('| {} |'.format(i + 1)) + exists = re.search(r'\|\s*{}\s*\|'.format(i+1), task_text) # 如果没有找到该编号的任务,直接返回 - if start < 0: + if exists is None: logger.error('没有从issue内容中找到编号为【{}】的赛题,请检查issue内容格式是否正确'.format(str(i + 1))) task_list.append(None) continue + start = exists.span()[0] end = start + 1 column = 0 task = {} @@ -492,4 +493,4 @@ def update_statistic_info(task_list, config): for user_name in users_info: statistic_info += "@{} ({}) ".format(user_name, str(users_info[user_name])) statistic_info += "\n" - return statistic_info \ No newline at end of file + return statistic_info