I have a 2D list:
items = [['a','b'],['c','d']]
I would like to get a new list containing the last element of each nested list:
new_list = ['b','d']
I can do it like so:
new_list = []
for i in items:
new_list.append(i[-1])
But this feels very clumsy for such a simple thing. I was wondering if there was a more elegant way of doing this.