Opening MS Word files via Python

Rob Nikander rnikaREMOVEnder at adelphia.net
Tue Apr 20 22:59:31 EDT 2004


Fazer wrote:
> I am curious as to how I should approach this issue.  I would just
> want to parse simple text and maybe perhaps tables in the future. 
> Would I have to save the word file and open it in a text editor?  That
> would kind of....suck...  Has anyone else tackled this issue?

The win32 extensions for python allow you to get at the COM objects for 
applications like Word, and that would let you get the text and tables. 
  google: win32 python.

word = win32com.client.Dispatch('Word.Application')
word.Documents.Open('C:\\myfile.doc')

But I don't know the best way to find out the methods and properties of 
the "word" object.

Rob




More information about the Python-list mailing list