Hey, I've got a list like
alist = [[a,b,(1,2)], [a,b,(1,2)], [a,b,(1,2)]]
I want to remove the third element from all the elements in alist, or it means the last one in the elements of a list
So the result will be
alist = [[a,b], [a,b], [a,b]]
Do we have any fast way to do this? Thanks!
Your script works in python shell, but does not work in my program, don't know why is that
happens.
I done the reading of Python quick book, heh~
rows = [[1,2,(1,2)],[1,2,(1,2)],[1,2,(1,2)]]
print rows
rows = [x[:-1] for x in rows]
print rows