title: Simple 1 line For Loops
body: <p>Typically I have used list comprehensions to iterate and filter by data (i.e dicts etc) within the need to write multiple line for loops.</p>
  
  <pre><code>[x['a']["b"] for x in s["items"] if x["car"] == "ford"]
  </code></pre>
  
  <p>However this returns a list such as :</p>
  
  <pre><code>[False]
  </code></pre>
  
  <p>Not a massive problem as I can write </p>
  
  <pre><code>[x['a']["b"] for x in s["items"] if x["car"] == "ford"][0]
  </code></pre>
  
  <p>However is there a way either with list comprehensions or another way to write a for loop which an if condition so that I only get a string returned ?</p>
  
  <p>Edit : In other words how can I place the following onto a single line and return a string,</p>
  
  <pre><code>for x in s["items"]:
      if x["car"] == "ford":
         print x['a']['b']
  </code></pre>
  
  <p>Thanks,</p>