[Tutor] df type function in python
Stuart Sears
stuart at sjsears.com
Wed Jan 7 19:27:56 CET 2009
On 07/01/09 18:08, Spencer Parker wrote:
> Is there anyway to get rid of the header information? I just want
> the output that it gives me for the device.
parse the output and junk the first line?
I'm no subprocess expert, but a bit of playing about suggests this would
work:
from subprocess import Popen, PIPE
df = Popen('df -P', shell=True, stdout=PIPE)
no_header = df.stdout.readlines()[1:]
I'm sure there are more elegant ways to do this, but it does work.
tuning the df -P command to only give you the device your are interested
in should reduce the output a little more.
Regards,
Stuart
ps there's need to reply to me directly, I'm subscribed to the list,
albeit mostly to cower at the feet of those who inhabit it :)
--
Stuart Sears RHCA etc.
"It's today!" said Piglet.
"My favourite day," said Pooh.
More information about the Tutor
mailing list