Re: [Tutor] Unintentionally manipulating a list

2011-02-25 Thread Steven D'Aprano
ranjan das wrote: 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'],[] ]

Re: [Tutor] Unintentionally manipulating a list

2011-02-25 Thread Knacktus
Am 25.02.2011 15:49, schrieb ranjan das: 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=[ ['A

Re: [Tutor] Unintentionally manipulating a list

2011-02-25 Thread Alex Hall
You may want to deepcopy instead of just copy? On 2/25/11, ranjan das wrote: > 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 wh

[Tutor] Unintentionally manipulating a list

2011-02-25 Thread ranjan das
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 followi