I use python and I don't know how to do.
I want to read lots of lines in files. But I have to read from second lines. All files have different lines, So I don't know how to do.
Code example is that it read from first line to 16th lines.
But I have to read files from second lines to the end of lines.
Thank you!:)
with open('filename') as fin:
for line in islice(fin, 1, 16):
print line
解决方案
You should be able to call next and discard the first line:
with open('filename') as fin:
next(fin) # cast into oblivion
for line in fin:
... # do something
This is simple and easy because of the nature of fin, being a generator.