title: Most Efficient Way to "Slurp" All of STDIN Into a String
body: <p>I'm writing an email parser for python 2.7 that will be invoked via sendmail using an alias, parsed using the email module and then processed and stored into an oracle database:</p>
  
  <p>From /etc/aliases:</p>
  
  <p>myalias: | /my/python/script.py</p>
  
  <p>I'm having trouble "slurping" all of stdin into a string object that I can use with the email module:</p>
  
  <pre><code>import email
  
  # Slurp stdin and store into message
  message =
  
  msg = email.message_from_string(message)
  
  # Do something with it
  print msg['Subject']
  </code></pre>
  
  <p>What would be the most efficient way to do this? I've tried stdin.readlines() but it ends up as a list. </p>
  
  <p>Thx for any help. (Sorry if this is noobish... I'm a perl convert and been forced to standardize my tools using python and this is only my second script. Well not really "forced", I've been wanting to do this for some time but not under the gun of a deadline like now)</p>