Get drives and partitions list (Linux)

Peter Hansen peter at
Tue Jun 14 02:21:11 CEST 2005

cantabile wrote:
> Hi, Peter
> Thanks for the reply. I'll check popen().
> But you said I should not rely on fdisk... Why ? And should I prefer
> sfdisk ? Why ?

I was under the impression that fdisk was older and more primitive, but 
a quick check shows I'm probably not only wrong, but had it backwards! 
(The man page for fdisk says "try parted, then fdisk, then sfdisk" 

Also, as you saw in Jeff's reply, there's a commands.getoutput() 
function that does basically what popen() would do, so just use whatever 
seems simplest.


More information about the Python-list mailing list