cool_go_blue wrote: > So, my following code: > > app = win32com.client.gencache.EnsureDispatch('Word.Application') > app.Documents.Open(r'D:/projects/Myself/HelloPython/src/Drugreservoir.doc') > app.ActiveDocument.SaveAs(r'D:/projects/Myself/HelloPython/src/Drugreservoir1.txt',FileFormat=win32com.client.constants.wdFormatText) > doc = > app.Documents.Open(r'D:/projects/Myself/HelloPython/src/Drugreservoir1.txt') > count = 0 > for word in doc.Content.Text.encode("cp1252", "replace").split(): > print word > > Does SaveAs save the doc to a txt file? What I was thinking is > "app.Documents.Open('D:/projects/Myself/HelloPython/src/Drugreservoir1.txt')" > can open the txt file which I can read. Is there any way I can read > the saved txt file after SaveAs... >
Well, of course there is. At that point, you have a plain, old, ordinary text file. Just use the normal Python techniques to read it. doc = open(r'D:/projects/Myself/HelloPython/src/Drugreservoir1.txt') for word in doc.read().split(): print word -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32