A
A
aqau1232022-02-23 01:39:43
Programming
aqau123, 2022-02-23 01:39:43

How to remove blank pages from python word?

There is a Word file, how can I delete all empty pages from it?
I use either python-docx, but if there are any other methods, they will do.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MiiNiPaa, 2016-03-27
@MiiNiPaa

b[i]=... And what does i equal here?

D
Denis Zagaevsky, 2016-03-27
@zagayevskiy

I suppose that in the formula:
sqrt(fabs(atan(k/2-1.5)))it meant not k, but a[k].
But then the loop needs to be changed - now it's k from 1 to n, and should be from 0 to n - 1.
And all this is assigned to b[i], although i does not change in the loop. Probably need b[k].
PS formatting is just awful, you better fix it.

D
Denis Shavaleev, 2022-02-23
@Shavaleev_DieZ

for paragraph in document.paragraphs:
    if len(paragraph.text)==0:
        paragraph.clear()

Taken from progi.pro .
Here there is a removal specifically separately of empty lines, but it is possible to beat.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question