Re: [Tutor] reducing lists within list to their set of unique values

2013-05-21 Thread Oscar Benjamin
On 21 May 2013 14:31, Treder, Robert wrote: > Steven wrote: >> >> py> L = ['b', 'd', 'c', 'a', 'b'] >> py> list(set(L)) >> ['a', 'c', 'b', 'd'] >> >> >> If keeping the order is important, you cannot use set, and you'll need >> another way to extract only the unique values. Ask if you need help on

Re: [Tutor] reducing lists within list to their set of unique values

2013-05-21 Thread Treder, Robert
> Message: 6 > Date: Tue, 21 May 2013 09:45:17 +1000 > From: Steven D'Aprano > To: tutor@python.org > Subject: Re: [Tutor] reducing lists within list to their set of unique > values > Message-ID: <519ab58d.9020...@pearwood.info> > Content-Type: text/

Re: [Tutor] reducing lists within list to their set of unique values

2013-05-20 Thread Steven D'Aprano
On 21/05/13 08:49, Treder, Robert wrote: Hi python folks, I have a list of lists that looks something like this: tst = [ [], ['test'], ['t1', 't2'], ['t1', 't1', 't2'] ] I want to change the empty sets to a blank string, i.e., '' and the lists with repeat values to the unique set of values. S

[Tutor] reducing lists within list to their set of unique values

2013-05-20 Thread Treder, Robert
Hi python folks, I have a list of lists that looks something like this: tst = [ [], ['test'], ['t1', 't2'], ['t1', 't1', 't2'] ] I want to change the empty sets to a blank string, i.e., '' and the lists with repeat values to the unique set of values. So I have done the following: >>> for