title: Python reading first four lines from readlines()
body: <p>How can I read the first four lines from <code>readlines()</code>, I am getting a <code>STDIN</code> from proxy to my script:</p>
  
  <pre><code>GET http://www.yum.com/ HTTP/1.1
  Host: www.yum.com
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Language: en-gb,en;q=0.5
  Accept-Encoding: gzip, deflate
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  Proxy-Connection: keep-alive
  </code></pre>
  
  <p>i read it using <code>sys.stdin.readlines()</code> and log it to file, but i want to log only <code>GET</code> and <code>User-Agent</code> lines to the file.</p>
  
  <pre><code>while True:
      line = sys.stdin.readlines()
      for l in line:
          log = open('/tmp/redirect.log', 'a')
          log.write(l)
          log.close()
  </code></pre>