```
def replace_text(replacements, shapes):
"""
替换PPT里的文本内容
"""
for shape in shapes:
for match, replacement in replacements.items():
match = str(match)
replacement = str(replacement)
if shape.has_text_frame:
if shape.text.find(match) != -1:
text_frame = shape.text_frame
for paragraph in text_frame.paragraphs:
whole_text = "".join(run.text for run in paragraph.runs)
# print(f"whole_text:{whole_text}")
whole_text = whole_text.replace(match, replacement)
for idx, run in enumerate(paragraph.runs):
if idx != 0:
p = paragraph._p
p.remove(run._r)
if bool(paragraph.runs):
paragraph.runs[0].text = whole_text
```