[Tutor] Reading every 5th line
nitin chandra
nitinchandra1 at gmail.com
Mon Aug 9 07:46:36 CEST 2010
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", "FileName02", ..., "FileName24"]
> for File in FileNames:
> List = open(File, 'r').readlines()
> for Start in [[14, "%s-1" % File], [15,"%s-2" % File]]:
> OutList = []
> for Line in range(Start[0]-1, 3024, 5):
> OutList.append(List[Line])
> open(("%s.txt" % Start[1]), 'w').writelines(OutList)
>
> P.S. My code writing style isn't very conventional.
>
>
More information about the Tutor
mailing list