title: python list comprehension transform
body: <p>I am trying to understand when should one use list comprehension. a lot of time, it is convenient and save lines. But sometimes, it does not work as expected?</p>
  
  <p>if I have:</p>
  
  <pre><code>listA = ['1', '2', '3', '4']
  </code></pre>
  
  <p>I can use a for loop</p>
  
  <pre><code>for i in listA:
      print(i)
  </code></pre>
  
  <p>obviously this will give me:</p>
  
  <pre><code>1
  2
  3
  4
  </code></pre>
  
  <p>what if I try:</p>
  
  <pre><code>print(i for i in listA)
  </code></pre>
  
  <p>but this won't give me the same result?</p>
  
  <pre><code>&lt;generator object &lt;genexpr&gt; at 0x102a3b3b8&gt;
  </code></pre>
  
  <p>How should I understand this?</p>
  
  <p>My additional question is:
  if I have a for loop followed by one line of codes, can one always write it in a way using comprehension?</p>