I have a nested list of tuples, that I need to break out into a single list and drop the first ordinal of each. I can't seem to figure out how to accomplish this.
I have sample data such as:
[[('Item 1', <__main__.J object at 0x1018fc690>), ('Item 2', <__main__.J object at 0x1018fc6d0>)]]
and I am trying to reduce that to
[<__main__.J object at 0x1018fc690>, <__main__.J object at 0x1018fc6d0>]
Could someone please point me in the right direction. I've tried itertools and zip(*) to no avail.
import itertools
import operator
class J(object):
pass
w = J()
w.Type = 'Item 1'
w.Page = 35
w.Fragment = 'AA'
q = J()
q.Type = 'Item 2'
q.Page = 78
q.Fragment = 'BA'
z = [[('Item 1', w),('Item 2', q)]]
y = [b for b in z]
print y
result = ([ a for a,b in z ], [ b for a,b in z ])
print result
print zip(*z)