Santiago Romero wrote:
I want to read text line-by-line from a text file, but want to ignore
only the first line. I know how to do it in Java (Java has been my
primary language for the last couple of years) and following is what I
have in Python, but I don't like it and want to learn the better way
of doing it.
Why don't you read and discard the first line before processing the
rest of the file?
file = open(filename, 'r')
file.readline()
for line in file: print line,
I believe that file.readline() will work better than file.next() for
most purposes since the latter will raise StopIteration on an empty file
whereas file.readline() merely returns ''.
--
http://mail.python.org/mailman/listinfo/python-list