Basic python question
I am new to python and trying to do some basic things with python. I
am writing a script that runs a df command and I need parts of that
output saved in 2 different variables. Is this something that can be
done? I can do this by running multiple df commands but would prefer
to make only one call:
inode_cmd = "/bin/df --output=pcent,ipcent /var| grep -v Use | tr '%' ' '"
output = subprocess.check_output( inode_cmd,
stderr=subprocess.STDOUT, shell=True )
But this would end up giving me the following:
#df --output=pcent,ipcent /var | grep -v Use | tr '%' ' '
I would like variable x to be 5 and variable y to be 1. Is there a
easier way to do this?
Thanks in advance for your guidance.