get_file_size

Egor Bolonev ebolonev at mail.ru
Sun Jun 29 19:23:22 EDT 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