file size 'mystery'

Sami Hangaslammi shangius at yahoo.com
Wed May 21 11:19:45 EDT 2003


> You are right for this case. But I left out an important part: the 
> "file" is an file-object of Zope (it does not exist in the FS). So I can 
> not use the os module of python.

For file objects and file-like objects that support seek, you can find
out the size of the file by doing f.seek(0,2) and f.tell(). Should be
more efficient than f.read() in most cases.




More information about the Python-list mailing list