delete from pattern to pattern if it contains match

Peter Otten __peter__ at web.de
Thu Apr 21 07:24:08 EDT 2016


harirammanohar at gmail.com wrote:

> On Monday, April 18, 2016 at 12:38:03 PM UTC+5:30, hariram... at gmail.com
> wrote:
>> HI All,
>> 
>> can you help me out in doing below.
>> 
>> file:
>> <start>
>>  guava
>> fruit
>> <end>
>> <start>
>>  mango
>> fruit
>> <end>
>> <start>
>>  orange
>> fruit
>> <end>

Is that literally what you have in the file?

> any one can guide me ? why xml tree parsing is not working if i have
> root.tag and root.attrib as mentioned in earlier post...

The data above is not valid xml. Instead of

<start>...<end>

you need

<start>...</start>

i. e. the end tag must be the same as the start tag, but with a leading "/".





More information about the Python-list mailing list