正则解析

This commit is contained in:
Àî×ÚÕñ 2022-09-08 09:43:10 +08:00
parent efecf08a9f
commit 6d61867b9d

View File

@ -323,10 +323,10 @@ def fmt_txt(chk_str):
for project_str in new_str_list1: for project_str in new_str_list1:
project_name_time_str = project_str.split('\n')[0] project_name_time_str = project_str.split('\n')[0]
dict_project = { dict_project = {
'name': '', 'company_name': '',
'time': '', 'time': '',
'comment': '', 'comment': '',
'work': '', 'position_name': '',
'duty': '', 'duty': '',
} }
project_name_time_str2 = re.split('([0-9]{4}[/|.][0-9]{1,2})', project_name_time_str) project_name_time_str2 = re.split('([0-9]{4}[/|.][0-9]{1,2})', project_name_time_str)
@ -337,7 +337,7 @@ def fmt_txt(chk_str):
if p_str[0].isdigit(): if p_str[0].isdigit():
dict_project['time'] = p_str + project_name_time_str2[index + 1] + \ dict_project['time'] = p_str + project_name_time_str2[index + 1] + \
project_name_time_str2[index + 2] project_name_time_str2[index + 2]
dict_project['name'] = project_name_time_str2[index + 3] dict_project['company_name'] = project_name_time_str2[index + 3]
break break
project_chk_str2 = project_str.split(project_name_time_str)[-1] project_chk_str2 = project_str.split(project_name_time_str)[-1]
project_chk_str2_list = re.split('(:|)', project_chk_str2) project_chk_str2_list = re.split('(:|)', project_chk_str2)
@ -363,7 +363,7 @@ def fmt_txt(chk_str):
if new_p_chk_list: if new_p_chk_list:
for p_str_true in new_p_chk_list: for p_str_true in new_p_chk_list:
if '开发环境' in p_str_true or '开发工具' in p_str_true or '开发技术' in p_str_true or '模块' in p_str_true: if '开发环境' in p_str_true or '开发工具' in p_str_true or '开发技术' in p_str_true or '模块' in p_str_true:
dict_project['work'] += re.split('[:|]', p_str_true)[-1] dict_project['position_name'] += re.split('[:|]', p_str_true)[-1]
continue continue
if '项目描述' in p_str_true or '功能介绍' in p_str_true: if '项目描述' in p_str_true or '功能介绍' in p_str_true:
dict_project['comment'] += re.split('[:|]', p_str_true)[-1] dict_project['comment'] += re.split('[:|]', p_str_true)[-1]
@ -376,10 +376,10 @@ def fmt_txt(chk_str):
else: else:
if project_undergo2.startswith(':') or project_undergo2.startswith(''): if project_undergo2.startswith(':') or project_undergo2.startswith(''):
dict_project = { dict_project = {
'name': '', 'company_name': '',
'time': '', 'time': '',
'comment': '', 'comment': '',
'work': '', 'position_name': '',
'duty': '', 'duty': '',
} }
new_str_list1 = [] new_str_list1 = []
@ -420,7 +420,7 @@ def fmt_txt(chk_str):
dict_project['name'] = re.split('[:|]', new_p_chk_list[0])[-1] dict_project['name'] = re.split('[:|]', new_p_chk_list[0])[-1]
for p_str_true in new_p_chk_list: for p_str_true in new_p_chk_list:
if '开发环境' in p_str_true or '开发工具' in p_str_true or '开发技术' in p_str_true or '模块' in p_str_true: if '开发环境' in p_str_true or '开发工具' in p_str_true or '开发技术' in p_str_true or '模块' in p_str_true:
dict_project['work'] += re.split('[:|]', p_str_true)[-1] dict_project['position_name'] += re.split('[:|]', p_str_true)[-1]
continue continue
if '项目描述' in p_str_true or '功能介绍' in p_str_true: if '项目描述' in p_str_true or '功能介绍' in p_str_true:
dict_project['comment'] += re.split('[:|]', p_str_true)[-1] dict_project['comment'] += re.split('[:|]', p_str_true)[-1]
@ -472,10 +472,10 @@ def fmt_txt(chk_str):
for project_str in new_str_list1: for project_str in new_str_list1:
project_name_time_str = project_str.split('\n')[0] project_name_time_str = project_str.split('\n')[0]
dict_project = { dict_project = {
'name': '', 'company_name': '',
'time': '', 'time': '',
'comment': '', 'comment': '',
'work': '', 'position_name': '',
'duty': '', 'duty': '',
} }
project_name_time_str2 = re.split('([0-9]{4}[/|.][0-9]{1,2})', project_name_time_str) project_name_time_str2 = re.split('([0-9]{4}[/|.][0-9]{1,2})', project_name_time_str)
@ -486,7 +486,7 @@ def fmt_txt(chk_str):
if p_str[0].isdigit(): if p_str[0].isdigit():
dict_project['time'] = p_str + project_name_time_str2[index + 1] + \ dict_project['time'] = p_str + project_name_time_str2[index + 1] + \
project_name_time_str2[index + 2] project_name_time_str2[index + 2]
dict_project['name'] = project_name_time_str2[index - 1] dict_project['company_name'] = project_name_time_str2[index - 1]
break break
project_chk_str2 = project_str.split(project_name_time_str)[-1] project_chk_str2 = project_str.split(project_name_time_str)[-1]
project_chk_str2_list = re.split('(:|)', project_chk_str2) project_chk_str2_list = re.split('(:|)', project_chk_str2)
@ -512,7 +512,7 @@ def fmt_txt(chk_str):
if new_p_chk_list: if new_p_chk_list:
for p_str_true in new_p_chk_list: for p_str_true in new_p_chk_list:
if '开发环境' in p_str_true or '开发工具' in p_str_true or '开发技术' in p_str_true or '模块' in p_str_true: if '开发环境' in p_str_true or '开发工具' in p_str_true or '开发技术' in p_str_true or '模块' in p_str_true:
dict_project['work'] += re.split('[:|]', p_str_true)[-1] dict_project['position_name'] += re.split('[:|]', p_str_true)[-1]
continue continue
if '项目描述' in p_str_true or '功能介绍' in p_str_true: if '项目描述' in p_str_true or '功能介绍' in p_str_true:
dict_project['comment'] += re.split('[:|]', p_str_true)[-1] dict_project['comment'] += re.split('[:|]', p_str_true)[-1]
@ -621,7 +621,7 @@ def fmt_txt(chk_str):
work_dict['duty'] = duty work_dict['duty'] = duty
work_list.append(str(work_dict)) work_list.append(str(work_dict))
dict_chk['work_list'] = work_list dict_chk['work_list'] = work_list
review = [] review = ''
upgrade = true_chkStr.split('教育经历')[-1] upgrade = true_chkStr.split('教育经历')[-1]
if '自我评价' or '自我描述' in upgrade: if '自我评价' or '自我描述' in upgrade:
if '自我评价' in upgrade: if '自我评价' in upgrade: