How to get filesystem in python.
Cousin Stanley
cousinstanley at gmail.com
Fri Jan 17 08:36:32 EST 2020
Antoon Pardon wrote:
> I would like to get the information given by the df command on linux/unix.
> I found the os.statvfs call, but it misses one thing: The filesystem.
>
> Does anyone know how to get that information.
>
import os
pipe_in = os.popen( 'df -h -T -x tmpfs -x devtmpfs' )
list_source = pipe_in.readlines()
for this_item in list_source[ 1 : ] :
this_list = this_item.strip().split()
file_sys = this_list[ 0 ]
file_type = this_list[ 1 ]
size = this_list[ 2 ]
used = this_list[ 3 ]
avail = this_list[ 4 ]
used_pc = this_list[ 5 ]
mounted = this_list[ 6 ]
--
Stanley C. Kitching
Human Being
Phoenix, Arizona
More information about the Python-list
mailing list