title: Print multiple lines from text file
body: <p>If i have a text file like this:</p>
  
  <pre><code>FastEthernet3/1
  ip address 0.0.0.0
  enable portfast
  
  FastEthernet3/2
  ip address 0.0.0.0
  enable portfast
  
  FastEthernet3/3
  ip address 0.0.0.0
  
  FastEthernet3/4
  ip address 0.0.0.0
  </code></pre>
  
  <p>And i would like to print out the interfaces that has not enabled portfast. How do i print this in python?</p>
  
  <p>i have the following code:</p>
  
  <pre><code>import os
  import sys
  
  root = "path to text file like the example above"
  
  os.chdir(root)
  
  current2 = os.getcwd()
  
  print ("CWD = ", current2,"\n")
  
  
  file = sys.argv[1]
  
  f = open(file)
  contents = f.read()
  f.close()
  print ("Number of GigabitEthernet:",contents.count("interface GigabitEthernet"))
  print ("Number of FastEthernet:",contents.count("FastEthernet"))
  
  
  x = open(file)
  string1 = "enable portfast"
  for line in x.readlines():
      if line.startswith(string1)
          print (line)
  filehandle.close()
  </code></pre>
  
  <p>so i can find the line with enable portfast and print it, but i want it to print more lines so i know witch interface has portfast enabled.</p>