Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:file': 0.07; 'subject:two': 0.07; 'any)': 0.09; 'iterate': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:into': 0.09; 'sections': 0.13; '-cc': 0.16; 'comp': 0.16; 'hi:': 0.16; 'received:80.91.229.3': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-dialin.net': 0.16; 'wrote:': 0.17; 'code.': 0.20; 'split': 0.23; 'second': 0.24; 'pass': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints- To:1': 0.28; 'lines': 0.28; 'post': 0.28; 'summary': 0.29; 'file': 0.32; 'print': 0.32; 'extract': 0.33; 'to:addr:python-list': 0.33; 'version': 0.34; 'text': 0.34; 'fail': 0.35; 'open': 0.35; 'received:org': 0.36; 'test': 0.36; 'option': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'back': 0.62; 'details': 0.63; 'here': 0.65; 'subject:....': 0.65; 'increase': 0.72; 'bla': 0.84; 'email addr:yahoo.co.in': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: how to split the file into two sections.... Date: Tue, 04 Dec 2012 10:07:54 +0100 Organization: None References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p50849210.dip.t-dialin.net User-Agent: KNode/4.7.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1354612056 news.xs4all.nl 6867 [2001:888:2000:d::a6]:46872 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34211 indu_shreenath@yahoo.co.in wrote: > Hi: > I have a text as > version comp X - aa > version comp Y - bbb > version comp Z -cc > > 12.12 Check for option 1 > > 12:13 Pass Test 1 > 12:14 verified bla bla bla > 12.15 completed > > 12.16 Fail Test 2 > 12:17 verified bla bla bla > 12.18 completed > > 12.19 Fail Test 3 > 12:20 verified bla bla bla > 12.21 completed > > 12.22 Check for option B > > 12:23 Pass Test4 > 12:24 verified bla bla bla > 12.25 completed > > 12.26 Fail Test 5 > 12:27 verified bla bla bla > 12.28 completed > > 12.29 Fail Test 6 > 12:30 verified bla bla bla > 12.31 completed > > In this I want to split the file to two sections to post the summary as > > Check for option 1 > Pass 2 > Fail 1 > Check for option 2 > Pass 2 > Fail 1 Open the file Iterate over the lines Extract the second word If it's "Check" print the current stats (if any) and remember the line If it's "Fail" increase a fail counter If it's "Pass" increase a fail counter Print the current stats (if any) [Optional] Come back here for help with the details once you have some code.