I have a word document in Docx format which has multiple blank pages. I need to delete all the blank pages in the document using python. I have tried to delete empty lines in the document. But it is not working. tried the below code: from docx import * document=Document("\\doc_path") z=len(document.paragraphs) for i in range(0,z): if document.paragraphs.text=="": document.paragraphs.clear() The above-mentioned code is not working and deleting all the intermediate empty lines on a page. Continue reading...