On Fri, Apr 25, 2014 at 11:07 PM, oyster <lepto.pyt...@gmail.com> wrote: > the above text should be splitted as a LIST with 3 items, and I also need to > know the KEY for LIST is ['I am section', 'let's continue', 'I am using']:
It's not perfectly clear, but I think I have some idea of what you're trying to do. Let me restate what I think you want, and you can tell be if it's correct. You have a file which consists of a number of lines. Some of those lines begin with the string "I am section", others begin "let's continue", and others begin "I am using". You want to collect those three sets of lines; inside each collection, every line will have that same prefix. Is that correct? If so, we can certainly help you with that. If not, please clarify. :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list