title: Using itertools groupby to create a list of lists
body: <p>I'm getting a list of items in the format <code>parent.id_child.id</code>, like <code>1_2</code>. I tried to group the child's id by parent id, for example:
  from the input <code>['1_2', '2_2', '1_1', '2_1', '1_3']</code> I need the output <code>[['1','2','3'], ['1','2']]</code>.
  I have tried this:</p>
  
  <pre><code>inputlist = ['1_2', '1_1', '2_1', '1_3', '2_2' ]
  outputlist= [item.split('_') for item in inputlist]
  outputlist.sort()
  final = [list(group) for key, group in itertools.groupby(outputlist, lambda x: x[0])]
  </code></pre>
  
  <p>This groups the elements correctly, by I need to obtain only the second element of each item. How can I achieve this? Also, can I do the whole thing in a single list comprehension sentence?</p>