LineReader

A line reader supports the name attribute and readline() function of a file object but none of the others. Its job is to keep track of line numbers in the file object.

Public Variables:

name

Name of the file.

Methods

__init__(self, file, lineNum)

   def __init__(self, file, lineNum = 1):

Constructs a new LineReader from a file object. If lineNum is specified, it should be the initial line number.

close(self)

   def close(self):

Closes the LineReader and its associated file.

getLineNumber(self)

   def getLineNumber(self):   

Returns the current line number of the file. This is also supported as lineNumber() for backwards compatibility.

readline(self)

   def readline(self):

Reads and returns the next line from the file.