Read a file starting from the second line in python

Viewed 12181

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
3 Answers
with open("filename", "rb") as fin:
    print(fin.readlines()[1:])
Related