python如何批量删除word中特定字符之间的换行符?

一个word文档中有几百篇短文,每篇大概内容如下:

主标题
——副标题
2021-10-13
内容:文字文字
(完)

主标题
——副标题
2021-10-14
内容:文字文字
(完)

主标题
——副标题
2021-10-15
内容:文字文字
(完)
……

如何通过python自动操作:
1.删除主标题、副标题两行之间的换行符,将主标题和副标题合在一起;
2.将时间放在标题前
3.选中所有标题,统一修改格式,如字体、字号、大纲级别等。

最终实现以下效果:

2021-10-13标题
内容:文字
(完)

2021-10-14标题
内容:文字
(完)

2021-10-15标题
内容:文字文字
(完)

……

可以提供一个word文档,以及结果图片吗?

给下源文档

题主可以参考下这个链接,python操作word,根据需要提取段落,再重构数据:
https://blog.csdn.net/u014543416/article/details/122101646?spm=1001.2014.3001.5502


import re
from docx import Document
from docx.shared import Pt
from docx.shared import Inches
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
 
alignment_dict={'justify':WD_PARAGRAPH_ALIGNMENT.JUSTIFY,
                'center':WD_PARAGRAPH_ALIGNMENT.CENTER,
                'right':WD_PARAGRAPH_ALIGNMENT.RIGHT,
                'left':WD_PARAGRAPH_ALIGNMENT.LEFT}
def get_docx_align(doc,align='justify'):
    for para in doc.paragraphs:
        inline=para.runs
        for i in range(len(inline)):
            inline[i].text=re.sub('[\t]+','',inline[i].text)
            inline[i].text=re.sub('[\n]+','\n',inline[i].text)
            inline[i].text=re.sub('[" "]+',' ',inline[i].text)
            #p=para._element
            #p.getparent().remove(p)
            #p._p=p._element=None
        paragraph=para
        paragraph_format=paragraph.paragraph_format
        paragraph_format.alignment=alignment_dict.get(align.lower())
doc=Document('Word_in.docx')
get_docx_align(doc,align='justify')
doc.save('Word_out.docx')