On 2008-08-23, W. eWatson <[EMAIL PROTECTED]> wrote:

> I have an ordinary text file with a CR at the end of a line, and two numbers 
> in each line. Is there some way to determine the number of lines (records) 
> in the file before I begin reading it?

If the lines are fixed lengh (e.g. always 12 bytes long), then
you can use os.stat() or os.fstat() to find the size of the
file.  Divide the size of the file by the number of bytes in a
line, and you get the number of lines.

-- 
Grant


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to