We have a 350 technical papers that we want to remove the lines with names and emails. Doing manual removal could take longer time…Is there a way that we can remove those lines using pything script? Really need your guidance on how to code it…I have a little background in Python…see image…thanks
I tried this code…but when email is in hyperlink format it wont remove.
import docx def delete_paragraph(paragraph): p = paragraph._element p.getparent().remove(p) #p._p = p._element = None doc = docx.Document('sample01.docx') lines = doc.paragraphs delline = ".com" for line in lines: if delline in (line.text): print(line.text) delete_paragraph(line) doc.save('sample01.docx')