title: transform list elements based on the string type (style)
body: <p>I have a list like below,</p>
  
  <pre><code>['Message-ID: &lt;5525962.1075855679785.JavaMail.evans@thyme&gt;\r\n',
  'Date: Wed, 13 Dec 2000 07:04:00 -0800 (PST)\r\n',
  'From: phillip.allen@enron.com\r\n',
  'To: christi.nicolay@enron.com, james.steffes@enron.com, jeff.dasovich@enron.com, \r\n',
  '\tjoe.hartsoe@enron.com, mary.hain@enron.com, pallen@enron.com,\r\n',
  '\tpkaufma@enron.com, richard.sanders@enron.com, \r\n',
  '\trichard.shapiro@enron.com, stephanie.miller@enron.com, \r\n',
  '\tsteven.kean@enron.com, susan.mara@enron.com, \r\n',
  '\trebecca.cantrell@enron.com\r\n',
  'Subject: \r\n',
  'Mime-Version: 1.0\r\n']
  </code></pre>
  
  <p>In that <code>To</code> attribute contains only 3 e-mail ids, followed by that elements some elements starts with <code>\t</code>. Actually those <code>\t</code> list elements continuation of <code>To</code> attribute. My objective is I want to merge all the missing elements from the <code>To</code> attribute.</p>
  
  <p>So far I used this below code to solve my problem.</p>
  
  <pre><code>l=['Message-ID: &lt;5525962.1075855679785.JavaMail.evans@thyme&gt;\r\n',
  'Date: Wed, 13 Dec 2000 07:04:00 -0800 (PST)\r\n',
  'From: phillip.allen@enron.com\r\n',
  'To: christi.nicolay@enron.com, james.steffes@enron.com, jeff.dasovich@enron.com, \r\n',
  '\tjoe.hartsoe@enron.com, mary.hain@enron.com, pallen@enron.com,\r\n',
  '\tpkaufma@enron.com, richard.sanders@enron.com, \r\n',
  '\trichard.shapiro@enron.com, stephanie.miller@enron.com, \r\n',
  '\tsteven.kean@enron.com, susan.mara@enron.com, \r\n',
  '\trebecca.cantrell@enron.com\r\n',
  'Subject: \r\n',
  'Mime-Version: 1.0\r\n']
  act= [ele.rstrip('\r\n') for ele in l if ele.startswith('To: ')]
  rem=[ele.lstrip('\t').rstrip('\r\n') for ele in l if ele.startswith('\t')]
  act.extend(rem)
  act=[''.join(act)]
  
  l=[ele for ele in l if not ele.startswith('To: ') and not ele.startswith('\t')]
  l.extend(act)
  print l
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>['Message-ID: &lt;5525962.1075855679785.JavaMail.evans@thyme&gt;\r\n',
  'Date: Wed, 13 Dec 2000 07:04:00 -0800 (PST)\r\n',
  'From: phillip.allen@enron.com\r\n',
  'Subject: \r\n',
  'Mime-Version: 1.0\r\n',
  'To: christi.nicolay@enron.com, james.steffes@enron.com, jeff.dasovich@enron.com, joe.hartsoe@enron.com, mary.hain@enron.com, pallen@enron.com,pkaufma@enron.com, richard.sanders@enron.com, richard.shapiro@enron.com, stephanie.miller@enron.com, steven.kean@enron.com, susan.mara@enron.com, rebecca.cantrell@enron.com']
  </code></pre>
  
  <p>I think I have made more complexity to my code.</p>
  
  <p>Is there any simple way or any other better way to approach this problem?
  or where can I improve my code efficiency?</p>
  
  <p>any efforts would be really appreciable.,</p>
  
  <p>Thanks in Advance.</p>