Home > front end >  Python to get no. of characters of files ending with .docx from a directory and divide each file
Python to get no. of characters of files ending with .docx from a directory and divide each file

Time:07-05

I have more than 100 Files in a directory. Every File Endswith .docx

I want to write a python code which gets the characters count for each and every word document and divide each document's no. of characters by 65 and store them to a excel sheet.

code of how i want:-

import python word document library
directory = /xyz/folder

for files in directory:
    if files .endswith(.docx):
        get character-count for each and every File
        divide each file's character count by 65
    with open myfile.xlsx as writable form:
        format:- name of the file, final character count of file
         do this to all files in a directory that endswith .docx

Note:- final character count of files means no. of characters with spaces divided by 65

enter image description here

  • Related