----- 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 know how much progress i made.

Truly, I am still foggy, as to how to include it in code.

Thanks

Nitin



Try using "range(start, end, step)".

If this is for a class exercise, it would be unfair to say more. If it's not
for an assignment, I can show you more.

Dave



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.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to