title: How to print all the lines after it found certain string in python?
body: <p>I have following lines in a file. I want to read the file after it found certain string.</p>
  
  <pre><code>This is 1st line
  This is 2nd line
  This is 3rd line
  This is 4th line
  This is 5th line
  </code></pre>
  
  <p>Here if the string "3" is found i want to copy all the lines after this into a another file.</p>
  
  <p>My output should be:</p>
  
  <pre><code>This is 3rd line
  This is 4th line
  This is 5th line in another file.
  </code></pre>
  
  <p>My code is:</p>
  
  <pre><code>file1=open("file1.txt","r")
  file2=open("file2.txt","w")
  line=fo.readlines()
    for line in lines:
        if "3" in line:
           print line
           file2.write(line)
  </code></pre>
  
  <p>It print only this line alone "This is 3rd line" Its not printing all the lines after this line??</p>