On Wed, 23 Mar 2005 23:27:54 +0100, "Gabriel F. Alcober" <[EMAIL PROTECTED]> wrote:
>Hi! There goes a newbie trouble: > >for i in range(0, len(subject)): > if subject[i] in preps: > psubject.append(noun_syn_parser(subject[0:i])) > subject[0:i] = [] > Perhaps (untested!): start = 0 for i, subj in enumerate(subject): if subj in preps: psubject.append(noun_syn_parser(subject[start:i])) start = i subject = subject[start:] # optional if you don't need the leftovers >Since the last line eliminates some elements of the list, I'm wondering >if it's somehow possible to change the value of "i" to 0 in order not to >get an index error. Any other ideas? >Thanks in advance. > > Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list