all Python 3osterm
os.statvfs_result
os — file system
Result type of os.statvfs(): fields f_bsize, f_frsize, f_blocks, f_bfree, f_bavail and more. The type exists everywhere; statvfs and fstatvfs are Unix-only.
Syntax
os.statvfs_result(...)
The fields distinguish the allocation block size (f_frsize) from the preferred I/O size (f_bsize) — use the former to compute space. f_bfree counts all free blocks, while f_bavail counts those available to ordinary users. Like stat_result it also behaves as a tuple. The type exists in the module everywhere, but only Unix can produce a value via statvfs.
Examples
import os
st = os.statvfs('/') # → ? только Unix: возвращается объект типа os.statvfs_result
print(type(st).__name__) # → ? только Unix: statvfs_result
print(st[0] == st.f_bsize) # → True — поля доступны и по индексу, и по имени
print(st.f_namemax) # → ? только Unix: предельная длина имени файла в этой ФС, например 255
print(bool(st.f_flag & os.ST_RDONLY)) # → False, если ФС смонтирована на запись
See also
Open in the full glossarydocs.python.orgReport an inaccuracy