if tmpFile.endswith('.xml') or tmpFile.endswith('.doc') or tmpFile.endswith(
    '.docx'):
    app = win32com.client.Dispatch('Word.Application')
app.Visible = False
app.Documents.Open(tmpFile)
Читатель документов, rtf и txt в python