Partition names with Python

John Hunter jdhunter at ace.bsd.uchicago.edu
Tue Jul 1 11:13:32 EDT 2003


>>>>> "Artur" == Artur M Piwko <pipen at beast_tu_kielce.pl> writes:

    Artur> And /proc/partitions.

Best yet!

import os
fh = file('/proc/partitions')

fh.readline() # eat the header
fh.readline() # eat the blank line

partitions = [line.split()[-1] for line in fh.readlines()]
print partitions





More information about the Python-list mailing list