title: Save for loop result in variable
body: <p>How do I save the results in a <code>for loop</code> into a <code>variable</code>?
  Basically what print does in this example:</p>
  
  <pre><code>myList = ['a' ,'b' , 'c' , 'd' , 'e']
  for i in myList:
      print i
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>&gt;&gt;&gt; 
  a
  b
  c
  d
  e
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>I want to save exactly this print result into a variable.</p>
  
  <p>Until now I solved it like this:</p>
  
  <pre><code>myList = ['a' ,'b' , 'c' , 'd' , 'e']
  for i in myList:
      if "a" in i:
          v1 = i
      if "b" in i:
          v2 = i
      if "c" in i:
          v3 = i
  
  allresults = v1+"\n"+v2+"\n"+v3
  print allresults
  </code></pre>
  
  <p>But the problem is if you do not know the length of the list because it is changing all the time (JSON), then you don't get all results.</p>
  
  <p>There needs to be a simpler way and all the infos I found here from other people were related to specific subjects like maths etc.</p>
  
  <p>To be more specific, I am trying to store the result of the for loop into a variable, it's not a question about Lists.</p>