get_file_size

Ben Finney bignose-hates-spam at and-zip-does-too.com.au
Mon Jun 30 00:49:47 CEST 2003


On Mon, 30 Jun 2003 09:34:15 +1100, Egor Bolonev wrote:
> 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.

    <http://python.org/doc/current/lib/module-os.path.html#l2h-1292>

-- 
 \       "Too many pieces of music finish too long after the end."  -- |
  `\                                                  Igor Stravinskey |
_o__)                                                                  |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B




More information about the Python-list mailing list