get_file_size

Egor Bolonev ebolonev at mail.ru
Mon Jun 30 01:23:22 CEST 2003


> > f=open('1','wb')
> > print len(f)
>
> You don't need to open the file to get its size.  The file's size is
> stored in the directory metadata about the file, along with its
> modification time, file name, permissions, etc.

How about that?
f=open('1','wb')
f.write(something)
print len(f)
Should I close file for get it size or should I write a C-like function with
seek(end),tell, seek(old)?






More information about the Python-list mailing list