title: best way to use inline for loop in lists and flat the result in python
body: <p>I have a list of dictionaries and in each of the dictionaries, I have a property that contains a list of ids. so I need to get the content of my properties as a new list . I tried to do this by inline for loop syntax . but I get this result :</p>
  <pre><code>my_list  = [{&quot;sessions&quot;: [1,2,3,42,56]}, {&quot;sessions&quot;: [1,52,53,4,55]},{&quot;sessions&quot;: [1,4,5]}]
  listed_sessions =[ s for s in [j[&quot;sessions&quot;] for j in my_list for item in j]]
  
  print(listed_sessions)
  </code></pre>
  <p>result :</p>
  <pre><code>[[1, 2, 3, 42, 56], [1, 52, 53, 4, 55], [1, 4, 5]]     
  </code></pre>
  <p>I mixed two different for loop as you can see. but I need to know, how can I get my result in a flat list?</p>