Opening MS Word files via Python
Tim Golden
tim.golden at viacom-outdoor.co.uk
Wed Apr 21 04:33:00 EDT 2004
>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?
Have a look at antiword: http://www.winfield.demon.nl/
It's not written in Python (afaik) but it writes to stdout.
Example:
<code>
import os
ANTIWORD = "c:/antiword/antiword.exe"
filename = raw_input ("Enter name of word doc: ")
text = os.popen ("%s %s" % (ANTIWORD, filename)).read ()
print text
</code>
TJG
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
More information about the Python-list
mailing list