Converting .doc to .txt in Linux
William Purcell
williamhpurcell at gmail.com
Thu Sep 4 20:14:10 EDT 2008
Here is a function that I have used with wvText to convert .doc files into
text files.
def readdoc(fpath):
tmp = 'tmp_readdoc.txt'
cmd = 'wvText %s %s'%(fpath,tmp)
os.system(cmd)
lines = open(tmp,'r').readlines()
os.unlink(tmp)
return lines
It's not a completely python dependent function but it might work in a
pinch. It depends on wv. I have tried the python uno and the Danny OOoLib
modules, which might be worth looking into but I didn't have much luck.
If you find a better or a completely python dependent method, let me know.
FWIW
-Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080904/e341abe0/attachment-0001.html>
More information about the Python-list
mailing list