Search for word in file python


















Add a comment. Active Oldest Votes. You can use regex to check whether the keywords are in the in text or not. Improve this answer. Athul Soori Athul Soori 81 1 1 silver badge 8 8 bronze badges.

Adil Mukhtar Adil Mukhtar 11 1 1 bronze badge. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. We just launched W3Schools videos. Get certified by completing a course today! If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:.

Example Where in the text is the word "welcome"? Example Where in the text is the first occurrence of the letter "e"? The technical storage or access that is used exclusively for statistical purposes. The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.

Manage options Manage third parties Manage vendors Read more about these purposes. Accept Deny View preferences Save preferences View preferences. Manage consent Manage consent. NET and Java products. Both can be used from Python. See Aspose. Words Programmers Guide, Utilize Aspose. Words in Other Programming Languages sorry I can't post a second link, stackoverflow does not let me yet. A docx is just a zip archive with lots of files inside.

Maybe you can look at some of the contents of those files? Other than that you probably have to find a lib that understands the word format so that you can filter out things you're not interested in. OLE Automation would probably be the easiest. You have to consider formatting, because the text could look like this in the XML:.

You should be able to use the MSWord ActiveX interface to extract the text to search or, possibly, do the search. I have no idea how you access ActiveX from Python though. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How can I search a word in a Word Ask Question. Asked 13 years, 3 months ago.



0コメント

  • 1000 / 1000