In addition when replacing text, you cannot simply replace it, you will loose all formatting.
Your text is contained in text_frame. Text_frame contain paragraphs, and paragraphs are made up of runs. A run contains all your formatting. You need to get to paragraph, then the run, then update text.
"A run exists to provide character level formatting, including font typeface, size, and color, an optional hyperlink target URL, bold, italic, and underline styles, strikethrough, kerning, and a few capitalization styles like all caps." (see reference below)
You'll need to do something like this:
prs = Presentation('data/p1.pptx')
for slide in prs.slides:
for shape in slide.shapes:
if not shape.has_text_frame:
continue
for paragraph in shape.text_frame.paragraphs:
for run in paragraph.runs:
run.text=newText(run.text)
prs.save('data/p1.pptx')
Official documentation(working with text): python-pptx.readthedocs.io
Visual representation of what this means Duplicate post