Searching for uniqness in a list of data

2006-03-01 Thread rh0dium
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

Re: Searching for uniqness in a list of data

2006-03-01 Thread Claudio Grondi
rh0dium wrote: 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,

Re: Searching for uniqness in a list of data

2006-03-01 Thread Alexander Schmolck
rh0dium [EMAIL PROTECTED] writes: 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

Re: Searching for uniqness in a list of data

2006-03-01 Thread johnzenger
You can come quite close to what you want without splitting the string at all. It sounds like you are asking the user to build up a string, and you want to keep checking through your list to find any items that begin with the string built up by the user. Try something like this: mylist =

Re: Searching for uniqness in a list of data

2006-03-01 Thread Alexander Schmolck
Alexander Schmolck [EMAIL PROTECTED] writes: The easiest way to do this is to have a nested dictionary of prefixes: for each prefix as key add a nested dictionary of the rest of the split as value or an empty dict if the split is empty. Accessing the dict with an userinput will give you all

Re: Searching for uniqness in a list of data

2006-03-01 Thread Paul McGuire
rh0dium [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 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

Re: [coding style] Searching for uniqness in a list of data

2006-03-01 Thread Bruno Desthuilliers
Claudio Grondi a écrit : (snip) code list=['1p2m_3.3-1.8v_sal_ms','1p2m_3.3-1.8v_pol_ms','1p3m_3.3-18.v_sal_ms'] Avoid using 'list' as an identifier. (snip) -- http://mail.python.org/mailman/listinfo/python-list