Hi, I want to read two non-consecutive lines once in a very big pileup file in python, that is, the expected result is the following(the number is the line number):
1 6 (the first time reads the 1st and 6th line)
2 7 (the second time reads the 2nd and 7th line)
3 8 (the third time reads the 3rd and 8th line)
4 9
5 10
6 11
7 12
8 13
9 14
10 15
..
..
..
..
.. (the last time reads the 6th from the last line and the last line)
The line number can be gotten by using the method enumerate(file object). I am a beginner for python, and just know how to read two consecutive lines once. Could you please share with me how to get the above expected result? Thanks for your time!
I think this should work, if I understand your question correctly. Not 100% on output you want and I'm not sure if this will print in the way tou want so you will need to play around with it. Good luck