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 = ['1p2m_3.3-1.8v_sal_ms','1p2m_3.3-1.8_sal_log']
sofar = ""

loop = True
while loop:
    selections = [ x[len(sofar):x.index("_", len(sofar) + 1)]
                   for x in mylist if x.startswith(sofar) ]
    loop = len(selections) > 1
    if loop:
        print selections
        sofar += raw_input("Pick one of those: ")

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to