In article <46a5e979-7a87-49ee-ac7e-71d3a235d...@e37g2000yqn.googlegroups.com>, joy99 <subhakolkata1...@gmail.com> wrote: > >input_string=raw_input("PRINT A STRING:") >string_to_word=input_string.split() >len_word_list=len(string_to_word) >if len_word_list>9: > rest_words=string_to_word[9:] > len_rest_word=len(rest_words) > if len_rest_word>9: > remaining_words=rest_words[9:]
input_string.split(None, 9) does something like what you want, but it does require recopying the tail each iteration. Overall, if you have enough RAM and you don't need to preserve input_string after splitting, your approach probably is the one I'd use. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." --Red Adair -- http://mail.python.org/mailman/listinfo/python-list