I tried to remove the third and the fourth list from the list of list in python.
My list of list is below:
List = [
['101', 'Dashboard', '1', '1'],
['102', 'Potential Cstomer', '1', '1'],
['102-01', 'Potential Cstomer', '1', '1'],
['102-02', 'Potential Cstomer Activity', '1', '1']
]
After remove the third and fourth element of list, I would like to be like this:
NewList = [
['101', 'Dashboard'],
['102', 'Potential Cstomer'],
['102-01', 'Potential Cstomer'],
['102-02', 'Potential Customer Activity']
]
I tried my code like below but it did not make any change.
NewList = [list(element) for element in List if element[0] or element[1]]
print NewList
How should I change my current code to achieve my expected result? Thanks.