To be completely correct, you should allow for the possibility that the word found is the last word in the list for j, word in enumerate(words): if (word.startswith("b")) and (j+1 < len(words)): print words[j+1] break -- http://mail.python.org/mailman/listinfo/python-list
- list previous or following list elements antar2
- Re: list previous or following list elements Terry Reedy
- Re: list previous or following list elements bearophileHUGS
- Re: list previous or following list elements Bruno Desthuilliers
- Re: list previous or following list elements Bruno Desthuilliers
- Re: list previous or following list elements Zentrader