Re: Total No. of "Records" in a File?

2008-08-26 Thread Bruno Desthuilliers
W. eWatson a écrit : Fredrik Lundh wrote: 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

Re: Total No. of "Records" in a File?

2008-08-26 Thread Bruno Desthuilliers
W. eWatson a écrit : 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? How could you know how many times a given character appears in file without readi

Re: Total No. of "Records" in a File?

2008-08-23 Thread W. eWatson
Fredrik Lundh wrote: 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

Re: Total No. of "Records" in a File?

2008-08-23 Thread Grzegorz Staniak
On 23.08.2008, W. eWatson <[EMAIL PROTECTED]> wroted: > Maybe. I could see it if the file were truly in a record format. The # of > records might be kept by the OS. It's conceivable that Python or the OS > might see a file with a CR as "recordized". Isn't it much easier to use a database inste

Re: Total No. of "Records" in a File?

2008-08-23 Thread W. eWatson
Nick Dumas wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Err...you want to know what is in a file before you open it? This could be done if you keep some external database documenting changes made to the file. But unless I misunderstand what you're saying, then it's not possible to know t

Re: Total No. of "Records" in a File?

2008-08-23 Thread Fredrik Lundh
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 li

Re: Total No. of "Records" in a File?

2008-08-23 Thread Grant Edwards
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

Re: Total No. of "Records" in a File?

2008-08-23 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Err...you want to know what is in a file before you open it? This could be done if you keep some external database documenting changes made to the file. But unless I misunderstand what you're saying, then it's not possible to know the contents of a fil

Total No. of "Records" in a File?

2008-08-23 Thread W. eWatson
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? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39