My question is quite simple, I have a list of lists :
my_list = [[\'a1\',\'b1\'],[\'a2\',\'b2\'],[\'a3\',\'b3\',\'c3\'],[\'a4\',\'b4\',\'c4\',\'d4\',\'e4\']]
See the below answer,
my_list = [['a1','b1'],['a2','b2'],['a3','b3','c3'],['a4','b4','c4','d4','e4']] new_list = [] for sub_list in my_list: new_list.append(sub_list[-1]) print(new_list) # o/p: [ 'b1' , 'b2' , 'c3' , 'e4' ]
I hope it helps you to find the answer.