Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107251

RE: delete from pattern to pattern if it contains match

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Joaquin Alzola <Joaquin.Alzola@lebara.com>
Newsgroups comp.lang.python
Subject RE: delete from pattern to pattern if it contains match
Date Mon, 18 Apr 2016 07:49:18 +0000
Lines 57
Message-ID <mailman.142.1460965767.6324.python-list@python.org> (permalink)
References <20c0b0fe-136b-4b01-b004-c55c6d47b299@googlegroups.com> <HE1PR07MB13566CAD4923756F8083F2ACF06B0@HE1PR07MB1356.eurprd07.prod.outlook.com>
Mime-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de 3SiRWZ+zmD7oEVF75h1Rmg39HjCSnTFXbknYQYJ92lTg==
Return-Path <Joaquin.Alzola@lebara.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.050
X-Spam-Evidence '*H*': 0.90; '*S*': 0.00; 'orange': 0.09; 'output': 0.13; 'message-----': 0.15; '2016': 0.16; 'fruit': 0.16; 'privilege.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'skip:[ 60': 0.16; 'all,': 0.20; 'to:name:python-list@python.org': 0.20; 'to:2**1': 0.21; 'file:': 0.22; 'help.': 0.23; 'import': 0.24; 'xml': 0.24; 'header:In-Reply-To:1': 0.24; 'module.': 0.27; 'be:': 0.29; 'url:mailman': 0.30; 'url:python': 0.33; 'skip:- 10': 0.34; 'url:listinfo': 0.34; 'sent:': 0.35; 'subject:': 0.35; 'but': 0.36; 'should': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'charset:us-ascii': 0.37; 'doing': 0.38; 'delete': 0.38; 'thank': 0.38; 'hi,': 0.38; 'end': 0.39; 'subject:from': 0.39; 'from:': 0.39; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'email addr:gmail.com': 0.62; 'contact': 0.66; 'python-list': 0.66; 'below.': 0.66; 'email name :python-list': 0.67; 'subject': 0.70; 'disclose': 0.71
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=lebara.onmicrosoft.com; s=selector1-lebara-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6lpD2cMpls8qvVBooTzlqS6syWeQINfqSjb9EafnyXA=; b=WINCDzLeHzArZkw/7c9CnsmDRnZVaY/fGLabamIOPmK+WhzOjEbP+ZtQ3wn5e6zlNW4bQ8AthY4roiDAT9GiNNPkSSRJpBWg34LaXZ6juG7iHSwboxtxUHIwCYnln+E3npEGiOMq9jgl+WMHQ5a5gI8hROEPuyhjzclY0VmSlYA=
Thread-Topic delete from pattern to pattern if it contains match
Thread-Index AQHRmUFcyRMTnsdPq0SA3C/wpB7qtp+PWvzA
In-Reply-To <20c0b0fe-136b-4b01-b004-c55c6d47b299@googlegroups.com>
Accept-Language en-GB, en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
authentication-results gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=lebara.com;
x-originating-ip [165.225.80.109]
x-ms-office365-filtering-correlation-id 379cc7b7-1004-4c3a-df0d-08d3675df275
x-microsoft-exchange-diagnostics 1; HE1PR07MB1353; 5:FCVaRw42Z+E9c8Fj2823EG+oISTpjJ3N82fjyB+dUD2Bmxo/ZdEqsZywKrRMpUEg2oTveGeJnonEaTtYRpCxn8mIugHkz8cZA9Be2bTVBvhIFqgtzX7vWYTIDVOBhyfw5u50KiepzGAZjmRhWrN8wZfJthWc79reTyMlkrqAyOAt0vJlR+PwDfxQPtExGf5Y; 24:fNtQeNhnCxby4FcBUSDnqsEk4wic/Ehe2b3hNoqOq/tD1Z8fgv7Axh2htAmVz8M7tg83SWbRCJi52gjRTISQWk1JVaU4KKx5kD+/Xxpq0Ng=; 7:KZI7MCnalv/vE17uh2q0xsbBkEYNHzNB0/+CMRlC52oEZIJMZA9rdLqXrYWPGnJ9I0lO4B76HoWl0N5ve7CD1kYjjxhCcniVEQ3X++730sb7Xl43Zv3lGFT4zNbjVyG5a7U9jGJ5r1+eIA2wIkkx4Q1jWQB6nh3SRaQ5MPI8uSHCkow2uRcJQmU8vIRfy3f3u9q947Wim9kDY81vxNkBMoTseKxwhO27DcrDq4WTSos=
x-microsoft-antispam UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR07MB1353;
x-microsoft-antispam-prvs <HE1PR07MB135362A097B4E331182D9828F06B0@HE1PR07MB1353.eurprd07.prod.outlook.com>
x-exchange-antispam-report-test UriScan:;
x-exchange-antispam-report-cfa-test BCL:0; PCL:0; RULEID:(9101521026)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:HE1PR07MB1353; BCL:0; PCL:0; RULEID:; SRVR:HE1PR07MB1353;
x-forefront-prvs 0916FC3A18
x-forefront-antispam-report SFV:NSPM; SFS:(10019020)(6009001)(13464003)(53754006)(74316001)(19580405001)(19580395003)(5002640100001)(81166005)(107886002)(11100500001)(86362001)(76576001)(66066001)(3280700002)(92566002)(5001770100001)(2906002)(87936001)(3660700001)(9686002)(50986999)(6116002)(10400500002)(5003600100002)(122556002)(586003)(3846002)(102836003)(1096002)(2950100001)(15975445007)(189998001)(5004730100002)(1220700001)(77096005)(106116001)(33656002)(2501003)(5008740100001)(76176999)(54356999); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR07MB1353; H:HE1PR07MB1356.eurprd07.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en;
spamdiagnosticoutput 1:23
spamdiagnosticmetadata NSPM
X-OriginatorOrg lebara.com
X-MS-Exchange-CrossTenant-originalarrivaltime 18 Apr 2016 07:49:18.6333 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader Hosted
X-MS-Exchange-CrossTenant-id d7093539-83cd-4991-b1b3-aacef74cf097
X-MS-Exchange-Transport-CrossTenantHeadersStamped HE1PR07MB1353
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <HE1PR07MB13566CAD4923756F8083F2ACF06B0@HE1PR07MB1356.eurprd07.prod.outlook.com>
X-Mailman-Original-References <20c0b0fe-136b-4b01-b004-c55c6d47b299@googlegroups.com>
Xref csiph.com comp.lang.python:107251

Show key headers only | View raw


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.com@python.org] On Behalf Of harirammanohar@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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-18 00:07 -0700
  RE: delete from pattern to pattern if it contains match Joaquin Alzola <Joaquin.Alzola@lebara.com> - 2016-04-18 07:49 +0000
    Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-18 01:52 -0700
    Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-18 21:01 -0700
  Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-21 03:17 -0700
    Re: delete from pattern to pattern if it contains match Peter Otten <__peter__@web.de> - 2016-04-21 13:24 +0200
      Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-22 02:00 -0700
        Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-22 02:14 -0700
          Re: delete from pattern to pattern if it contains match Peter Otten <__peter__@web.de> - 2016-04-22 11:50 +0200
            Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-24 23:24 -0700
    Re: delete from pattern to pattern if it contains match Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-21 16:32 +0300
      Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-22 01:59 -0700
        Re: delete from pattern to pattern if it contains match Peter Otten <__peter__@web.de> - 2016-04-22 11:24 +0200
          Re: delete from pattern to pattern if it contains match Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-22 14:10 +0300
            Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-24 23:29 -0700
              Re: delete from pattern to pattern if it contains match Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-25 10:17 +0300
                Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-25 02:49 -0700
                Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-25 02:53 -0700
                Re: delete from pattern to pattern if it contains match Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-25 13:37 +0300
                Re: delete from pattern to pattern if it contains match Peter Otten <__peter__@web.de> - 2016-04-25 12:13 +0200
                Re: delete from pattern to pattern if it contains match Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-25 13:39 +0300
                Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-25 04:02 -0700
                Re: delete from pattern to pattern if it contains match Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-25 14:28 +0300
                Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-25 04:40 -0700
                Re: delete from pattern to pattern if it contains match Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-25 15:00 +0300
                Re: delete from pattern to pattern if it contains match Peter Otten <__peter__@web.de> - 2016-04-25 14:33 +0200
                Re: delete from pattern to pattern if it contains match harirammanohar@gmail.com - 2016-04-26 03:31 -0700
                Re: delete from pattern to pattern if it contains match Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-25 13:24 +0300
                RE: delete from pattern to pattern if it contains match Joaquin Alzola <Joaquin.Alzola@lebara.com> - 2016-04-25 10:19 +0000

csiph-web