Disc space on a floppy disc
Roman Suzi
rnd at onego.ru
Thu Jan 3 11:31:04 EST 2002
On Thu, 3 Jan 2002, Florian Fredegar Haftmann wrote:
> Hi!
>
> Is there any possibility for python under Linux to test how much disc
> space on a floppy disc is free (except by parsing the output of the "df"
> command)?
There is os.statvfs() function and constants of statvfs
to interpret results of os.statvfs call.
For example:
>>> print os.statvfs("/boot")
(1024, 1024, 23333, 13088, 11884, 6024, 5988, 5988, 0, 255)
>>> os.system("df")
Filesystem 1k-blocks Used Available Use% Mounted on
...
/dev/hda4 23333 10245 11884 46% /boot
...
(please, not that available space is not all space that is
available. Usually 5% are reserved for root on ext2 filesystems.
Not sure about floppies.)
Sincerely yours, Roman A.Suzi
--
- Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
More information about the Python-list
mailing list