Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Joaquin Alzola 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: References: <20c0b0fe-136b-4b01-b004-c55c6d47b299@googlegroups.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: 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <20c0b0fe-136b-4b01-b004-c55c6d47b299@googlegroups.com> Xref: csiph.com comp.lang.python:107251 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=3Dlebara.com@p= ython.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: guava fruit mango fruit orange fruit need to delete from start to end if it contains mango in a file... output should be: guava fruit orange fruit 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 cont= act the sender immediately upon receipt.