Searching for uniqness in a list of data

rh0dium steven.klass at gmail.com
Wed Mar 1 10:49:00 EST 2006


Hi all,

I am having a bit of difficulty in figuring out an efficient way to
split up my data and identify the unique pieces of it.

list=['1p2m_3.3-1.8v_sal_ms','1p2m_3.3-1.8_sal_log']

Now I want to split each item up on the "_" and compare it with all
others on the list, if there is a difference I want to create a list of
the possible choices, and ask the user which choice of the list they
want.  I have the questioning part under control.   I can't seem to get
my hands around the logic - the list could be 2 items or 100 long.  The
point of this is that I am trying to narrow a decision down for an end
user.  In other words the end user needs to select one of the list
items, and by breaking it down for them I hope to simplify this.

list=['1p2m_3.3-1.8v_sal_ms','1p6m_3.3-1.8_sal_log']
 would only question the first data set ['1p2m', '1p6m' ]

list=['1p2m_3.3-1.8v_sal_ms','1p2m_3.3-1.8v_pol_ms','1p3m_3.3-18.v_sal_ms']
 If on the list ['1p2m','1p2m','1p3m'] the user selected 1p2m then the
next list would only be ['sal','pol']
 but if the user initially only selected 1p3m they would be done..

I hope this clarifies what I am trying to do.  I just can't seem to get
my hands around this - so an explaination of logic would really be
helpfull.  I picture a 2d list but I can't seem to get it..




More information about the Python-list mailing list