Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #34208 > unrolled thread
| Started by | indu_shreenath@yahoo.co.in |
|---|---|
| First post | 2012-12-03 23:32 -0800 |
| Last post | 2012-12-04 10:07 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
how to split the file into two sections.... indu_shreenath@yahoo.co.in - 2012-12-03 23:32 -0800
Re: how to split the file into two sections.... Peter Otten <__peter__@web.de> - 2012-12-04 10:07 +0100
| From | indu_shreenath@yahoo.co.in |
|---|---|
| Date | 2012-12-03 23:32 -0800 |
| Subject | how to split the file into two sections.... |
| Message-ID | <a36c0dce-68b9-462c-aa23-44c2f88a54c4@googlegroups.com> |
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
[toc] | [next] | [standalone]
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2012-12-04 10:07 +0100 |
| Message-ID | <mailman.453.1354612056.29569.python-list@python.org> |
| In reply to | #34208 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web