title: How to retrieve plain text from .doc files using Python?
body: <p>How can I pull out plain text from a .doc file? (MSDoc 97-03) I'm able to pull out plain text from .docx but not .doc</p>
  
  <p>I've got an almost working code for .doc, which goes like this</p>
  
  <pre><code>        if file.endswith('.doc'):
              app = win32com.client.Dispatch('Word.Application')
              doc = app.Documents.Open(fullpath)
              docText = (doc.Content)
              print docText
              app.Quit()
  </code></pre>
  
  <p>The problem is, whenever I run this code, I get both the plain text and an error which goes like this:</p>
  
  <p>This is a testing file to test the code:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Users\IdaLim\Desktop\MyTestCode\FileIO.py", line 76, in &lt;module&gt; doc =                  
  
    app.Documents.Open(fullpath) File "C:\Python27\lib\site-
    packages\win32com\client\dynamic.py", line 522, in __getattr__ raise 
    AttributeError("%s.%s"% (self._username_, attr)) AttributeError: Word.Application.Documents
  </code></pre>
  
  <p>On top of that, if the plain text includes non-alphabet characters like "!@#$%", the program will not output the plain text, and gives an error that says incompatible Unicode or something.</p>
  
  <p>Do you know of any functioning code that allow almost perfect retrieval of plain text from .doc files?</p>