Step 1 install package python-docx
pip install python-docx
pip show python-docx
If you install on terminal and PyCharm terminal, python version and environments may differ. Install on where you want to use it, otherwise you many find the package not found after install.
Step 2: code
# For reading file name
import glob
from tqdm import tqdm
# for python-docx package
# create words documents
from docx import Document
from docx.shared import Inches
from docx.shared import Cm
if __name__ == '__main__':
imgs = glob.glob('*.jpg')
document = Document()
for im in tqdm(imgs):
document.add_picture(im, width=Inches(4)
document.save('cleaning-report.docx')