Size of files in human, readable form

tim muddletin timmuddletin at news.vex.net
Thu Dec 16 08:19:34 EST 1999


On Thu, 16 Dec 1999 14:30:24 +0100, Thomas Weholt <thomas at bibsyst.no> wrote:
>Just wondered if there are any modules/methods/ways to get a file`s size
>in kilobytes or megabytes etc, based on what`s appropriate? Probably a
>simple thing to do, but my attempts have failed.

Your in luck, simple things are my speciality!

>>> import os,sys
>>> os.path.getsize(sys.executable)
24638
>>> os.stat(sys.executable)[6]
24638
>>>






More information about the Python-list mailing list