File object question

S. D. Rose s_david_rose at hotmail.com
Fri Dec 23 09:08:29 EST 2005


Yes, len() will do what I want.  I didn't realize it would work with binary,
I thought it was good only for variables, lists, etc.

Thanks!
-Dave

"Kent Johnson" <kent at kentsjohnson.com> wrote in message
news:43ab3f2c_1 at newspeer2.tds.net...
> S. D. Rose wrote:
> > Hello all.
> >   If I read a binary file:
> >
> > file = open('c:\\logo.gif', 'rw'') # Read from FS as one way to get the
> > object, d/l from website another...
> > file.read()
> >
> > is there anyway I can determine the 'size' of the object file? (Without
> > going to the filesystem and reading the filesize from the directory ...)
>
> Once you have read the data you can get the size of that:
> d = file.read()
> print len(d)
>
> Is that what you mean? Otherwise I don't know how you can get the size of
a file without
> asking the filesystem...
>
> Kent
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>






More information about the Python-list mailing list