W. eWatson 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?

In the general case, no. A file is just a bunch of bytes. If you know that all lines have exactly the same length, you can of course fetch the file size and divide by the line size, but that doesn't work for arbitrary files.

Why do you need to know the number of lines before reading it, btw?

</F>

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

Reply via email to