Re: [Tutor] Reading every 5th line

2010-08-09 Thread Dave Angel
nitin chandra wrote: removed top-post This may help you get started. FileNames =FileName01, FileName02, ..., FileName24] for File in FileNames: List =pen(File, 'r').readlines() for Start in [[14, %s-1 % File], [15,%s-2 % File]]: OutList =] for Line in range(Start[0]-1, 3024,

[Tutor] Reading every 5th line

2010-08-08 Thread nitin chandra
Hello Everyone, I am to make a small programme for a friend of mine where i am to start reading from 14th (string) from a file and then read every 5th row. ie. in 1st read it reads the 14 row in a File, write to an OUTPUT-1 file Next reads 19th row, write to the OUTPUT-1 file then 24th row,...

Re: [Tutor] Reading every 5th line

2010-08-08 Thread davidheiserca
- Original Message - From: nitin chandra nitinchand...@gmail.com To: tutor@python.org Sent: Sunday, August 08, 2010 5:04 AM Subject: [Tutor] Reading every 5th line Hello Everyone, I am to make a small programme for a friend of mine where i am to start reading from 14th (string

Re: [Tutor] Reading every 5th line

2010-08-08 Thread davidheiserca
- Original Message - From: nitin chandra nitinchand...@gmail.com To: davidheise...@gmail.com Sent: Sunday, August 08, 2010 7:29 AM Subject: Re: [Tutor] Reading every 5th line Thank you all. @Dave - Thank you for the tip. No this is not a class exercise, that is assured. Will let

Re: [Tutor] Reading every 5th line

2010-08-08 Thread Steven D'Aprano
On Sun, 8 Aug 2010 10:04:21 pm nitin chandra wrote: Hello Everyone, I am to make a small programme for a friend of mine where i am to start reading from 14th (string) from a file and then read every 5th row. There are many variations, here's one: Write a loop that executes 14 times. Inside

Re: [Tutor] Reading every 5th line

2010-08-08 Thread bob gailer
On 8/8/2010 8:04 AM, nitin chandra wrote: Hello Everyone, I am to make a small programme for a friend of mine where i am to start reading from 14th (string) from a file and then read every 5th row. ie. in 1st read it reads the 14 row in a File, write to an OUTPUT-1 file Next reads 19th row,

Re: [Tutor] Reading every 5th line

2010-08-08 Thread Dave Angel
nitin chandra wrote: Hello Everyone, I am to make a small programme for a friend of mine where i am to start reading from 14th (string) from a file and then read every 5th row. ie. in 1st read it reads the 14 row in a File, write to an OUTPUT-1 file Next reads 19th row, write to the OUTPUT-1

Re: [Tutor] Reading every 5th line

2010-08-08 Thread nitin chandra
Hello Dave, Thank you very much. This solution worked out very well. And I liked your style of coding ' In less DO more '. Thank You once again. Nitin PS :- I tried to use a file pointer with raw_input, but that did not work. This may help you get started. FileNames = [FileName01,