title: Python 2.7 recv from socket until newline
body: <p>I get data over tcp ip connection and have to read it. My problem is that I don't not know the length, just that there is "\n" at the end.</p>
  
  <pre><code>text = ""
  while True:
      data = s.recv(1)
      text += data
      if data == "\n":
          break
  return text
  </code></pre>
  
  <p>Using this code the functionality is ok, but it is to slow for my application (the "if" seems to be the slow part).  Maybe about half a second I have to wait and I just get between 3 and 8 bytes.</p>
  
  <p>So is it possible to get that done faster?</p>