size of a file

p.vrijlandt at aig.azn.nl p.vrijlandt at aig.azn.nl
Wed Jul 25 09:05:39 EDT 2001


>  "Janos Blazi" <jblazi at hotmail.com> wrote:
> 
> > How can I find out the length of a file. I have a descriptor fd of the file
> > (I am using the os module).

import os
import stat

# file denotes a file-object
def fsize(file):
    return os.stat(file.name)[stat.ST_SIZE]



--
Patrick Vrijlandt




More information about the Python-list mailing list