how to split this kind of text into sections

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Apr 25 11:32:48 EDT 2014


On Fri, 25 Apr 2014 09:18:22 -0400, Roy Smith wrote:

> In article <mailman.9492.1398431281.18130.python-list at python.org>,
>  oyster <lepto.python at gmail.com> wrote:

>> [demo text starts]
>> a line we do not need
>> I am section axax
>> I am section bbb, we can find that the first 2 lines of this section
>> all startswith 'I am section'
>> .....(and here goes many other text)... let's continue to
>>  let's continue, yeah
>>  .....(and here goes many other text)...
>> I am using python
>> I am using perl
>>  .....(and here goes many other text)...
>> [demo text ends]
> 
> This kind of looks like a standard INI file.

I don't think so. INI files are a collection of KEY=VALUE or KEY:VALUE 
pairs, and the example above shows nothing like that. The only thing 
which is even vaguely ini-like is the header [demo text starts], and my 
reading of that is that it is *not* part of the file, but just an 
indication that the OP is giving a demo.




-- 
Steven D'Aprano
http://import-that.dreamwidth.org/



More information about the Python-list mailing list