title: Python: Take Every First, Second, Third Element in Sublist
body: <p>I'm using Python 2.7 and have the following:</p>
  
  <p><code>my_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]</code></p>
  
  <p>I'd like create a 1-d list where the elements are ordered by position in sublist and then order of sublist.  So the correct output for the above list is:</p>
  
  <p><code>[1, 4, 7, 2, 5, 8, 3, 6, 9]</code></p>
  
  <p>Here's my (incorrect) attempt:</p>
  
  <pre><code>def reorder_and_flatten(my_list):
      my_list = [item for sublist in my_list for item in sublist]
      result_nums = []
      for i in range(len(my_list)):
          result_nums.extend(my_list[i::3])
      return result_nums
  result = reorder_and_flatten(my_list)
  </code></pre>
  
  <p>This flattens my 2-d list and gives me: </p>
  
  <pre><code>[1, 4, 7, 2, 5, 8, 3, 6, 9, 4, 7, 5, 8, 6, 9, 7, 8, 9]
  </code></pre>
  
  <p>The first half of this list is correct but the second isn't.</p>
  
  <p>I'd also like my function to be able to handle only 2 sublists.  For instance, if given:</p>
  
  <p><code>[[1, 2, 3], [], [7, 8, 9]</code></p>
  
  <p>the correct output is:</p>
  
  <p><code>[1, 7, 2, 8, 3, 9]</code></p>
  
  <p>Any thoughts?</p>
  
  <p>Thanks!</p>