title: How can I combine a conditional with a for loop in Python?
body: <p>I have a simple example I've drawn up.  I thought it was possible to combine if statements and for loops with minimal effort in Python.  Given:</p>
  
  <pre><code>sublists = [number1, number2, number3]
  
  for sublist in sublists:
      if sublist:
          print(sublist)
  </code></pre>
  
  <p>I thought I could condense the for loop to:</p>
  
  <pre><code>for sublist in sublists if sublist:
  </code></pre>
  
  <p>but this results in invalid syntax.  I'm not too particular on this example, I just want a method of one lining simple if statements with loops.</p>