Get drives and partitions list (Linux)

Peter Hansen peter at engcorp.com
Mon Jun 13 20:21:11 EDT 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" 
basically...)

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.

-Peter



More information about the Python-list mailing list