shutil.disk_usage() in Python is designed to get statistics on disk usage for a specified path. This method returns a named tuple with the attributes total , used , and free . The total attribute represents the amount of total space, the used attribute — the amount of space used, and the free attribute — the amount of space available in bytes.
Note. On Windows, the specified path must represent a directory, but on Unix systems, it can be a file or directory.
Syntax: shutil.disk_usage (path)
path : A path-like object representing a file system path. A path-like object is either a string or bytes object representing a path.
Return Type: This method returns a named tuple with attributed total, used and free.
Code: using the shutil.disk_usage () method
Disk usage statistics: usage (total = 244934381568, used = 13350301696, free = 219070689280)