How to read and delete lines from *.doc file (not docx)

Hello All…need ideas on how to work with *.doc files. Using python, I want to read and find specific word and delete it. thanks

This link seems like a good jumping off point. I’d go through this then search around for other methods. What you want is really common, so lots of resources. I’d also use Pathlib for my path.

If you want to delete from multiple files, you’ll need to loop through the files. I typically build a function that gets the Path() of the files I want to work with. Then I loop through those file paths performing my work.

1 Like

I am working with *.doc file…the links you shared does not work with *.doc when i tried.
In the sample image i want to delete the emails from the *.doc file using python script. thanks


See here / try this;

I found this one yesterday as well, but it will only work with *.DOCX…it does not work with *.DOC file…I have tried it…thanks