title: Python program to extract text from a text file?
body: <p>I have a text file which I obtained from converting a .srt file. The content is as follows:</p>
  
  <pre>
  1
  0:0:1,65 --> 0:0:7,85
  Hello, my name is Gareth, and in this
  video, I'm going to talk about list comprehensions
  
  
  2
  0:0:7,85 --> 0:0:9,749
  in Python.
  </pre>
  
  <p>I want only the words present the text file such that the output is a new textfile op.txt, with the output represented as:</p>
  
  <pre>
  Hello
  my
  name 
  is
  Gareth
  and
  </pre>
  
  <p>and so on.</p>
  
  <p>This is the program I'm working on:</p>
  
  <pre><code>import os, re
  f= open("D:\captionsfile.txt",'r')
  k=f.read()
  g=str(k)
  f.close()
  w=re.search('[a-z][A-Z]\s',g)
  fil=open('D:\op.txt','w+')
  fil.append(w)
  fil.close()
  </code></pre>
  
  <p>But the output I get for this program is:</p>
  
  <pre>
  None
  None
  None
  </pre>