You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
484 B

import re
pantten_zhang = "第[0-9一二三四五六七八九]章"
pantten_biaoti = '[1一Ⅰ][、.]\s{0,}?[\u4e00-\u9fa5a-zA-Z]+'
pantten_zhang_name = "[^0-9.]+"
pantten_other_biaoti = '[2-9二三四五六七八九ⅡⅢⅣⅤⅥⅦⅧⅨ][、.]\s{0,}?[\u4e00-\u9fa5a-zA-Z]+'
biaoti_list = []
text = "1.aaa绪论"
text_2 = "1.1绪论"
text_3 = "Ⅶ. asa大标题"
text_4 = "1.1绪论"
result_biaoti_list = re.findall(pantten_other_biaoti, text_3)
print(result_biaoti_list)