>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...

Yes of course, you can use the ordinary Python file functions as
described here:
http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-fil
es
For example:

        myfile =
open(r'D:\projects\Myself\HelloPython\src\Drugreservoir.txt')
        filetext = myfile.read()
        myfile.close()

will read the entire contents of the text file into the Python variable
filetext.

If you just want to get the word count of this text, you don't need to
use a loop, by the way - you can get it from:

        wordcount = len(filetext.split())

Tom Hawkins
Principal Scientist
Innospec Inc
Tel: +44 (0)151 356 6197
Fax: +44 (0)151 356 6112
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to