title: How to loop through an object attribute with list comprehension?
body: <p>I have a list - <code>list_of_objects = [&lt;obj1&gt;,&lt;obj2&gt;]</code>. Each object has an attribute <code>&lt;ob1j&gt;.content</code>. Each <code>content</code> attribute holds a list of dictionaries <code>[{&quot;key&quot;:&quot;value&quot;}, {&quot;key&quot;:&quot;value&quot;}]</code>. How do I use list comprehension to &quot;unpack&quot; these dictionaries into a single list? Example that doesn't work:</p>
  <pre><code>list_of_dictionaries = [dict for obj in list_of_objects for item in obj.content]
  </code></pre>
  <p>Basically I want to turn the below loop that works into a comprehension:</p>
  <pre><code>for obj in list_of_objects:
      new_list.extend(obj.content)
  </code></pre>