Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

to read first 5 lines and then next 5  RSS feed

 
ramjcp kris
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All
can any one help me how to read first x lines say(5)
from a file ,and when i say getNextLines it should return me the lines from x+1 to some increment no of lines in the same file.

i have tried it using BufferedReader and implemented using mark , but just helpless...

pls provide me some sample code....
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BufferedReader has the readLine method, which reads exactly one line of text. Using that, it should be easy to read x lines of text. The mark method won't be of any help with this.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!