I am facing the following problem
I have a list of the form INPUT= [ [ ['A1-N','A2-Y','A3-N' ],['B1-Y','B2-N','B3-N' ] ], [.........] ] and I want an output of the form (selecting only those elements which have a Y associated with them) OUTPUT=[ ['A2-Y', 'B1-Y'],[....] ] I wrote the following code. Although it gives me the desired output, it CHANGES the list INPUT now after i run the code I get INPUT as the same as OUTPUT (which i dont want to happen). I have used the copy function but it still is not working. Any help or pointers is appreciated *CODE* from copy import copy temp=copy( INPUT ) OUTPUT=temp for i in range(len(temp)): for j in range(len(temp[i])): for k in range(len(temp[i][j])): if temp[i][j][k][-1]=='Y': OUTPUT[i][j]=temp[i][j][k]
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor