On Monday, April 18, 2016 at 1:19:43 PM UTC+5:30, Joaquin Alzola wrote:
> Hi,
> 
> Try to use the xml module.
> 
> import xml.etree.ElementTree as ET
> 
> That might help.
> 
> BR
> 
> Joaquin
> 
> -----Original Message-----
> From: Python-list 
> [mailto:python-list-bounces+joaquin.alzola=lebara....@python.org] On Behalf 
> Of harirammano...@gmail.com
> Sent: 18 April 2016 08:08
> To: python-list@python.org
> Subject: delete from pattern to pattern if it contains match
> 
> 
> HI All,
> 
> can you help me out in doing below.
> 
> file:
> <start>
>  guava
> fruit
> <end>
> <start>
>  mango
> fruit
> <end>
> <start>
>  orange
> fruit
> <end>
> 
> need to delete from start to end if it contains mango in a file...
> 
> output should be:
> 
> <start>
>  guava
> fruit
> <end>
> <start>
>  orange
> fruit
> <end>
> 
> Thank you
> --
> https://mail.python.org/mailman/listinfo/python-list
> This email is confidential and may be subject to privilege. If you are not 
> the intended recipient, please do not copy or disclose its content but 
> contact the sender immediately upon receipt.

hi Alzola,

xml parsing solution works fine only in the below case if input file is in 
below format.
<data>
<start> 
 guava 
fruit 
<end> 
<start> 
 mango 
fruit 
<end> 
<start> 
 orange 
fruit 
<end> 
</data>

its not working if the input file as below, just a change in the starting 
header...
<data xmlns="http://xmlns.jcp.org/xml/ns/javaee";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd";
  version="3.1">
<start> 
 guava 
fruit 
<end> 
<start> 
 mango 
fruit 
<end> 
<start> 
 orange 
fruit 
<end>
</data>

inthis case its not working.... pls suggest what i have to do to make it work..
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to