Partition names with Python

Gerhard Häring gh at
Mon Jun 30 17:39:44 CEST 2003

Erhan Ekici wrote:
> Hi,
> How do I get partition names (i.e. C:\ , D:\ ,E:\ on windows, hda,hda1 , hda2 
> on Linux machines) using Python.

On Windows, this requires the win32 extensions. See

Why would you want to do this on Unix? Anyway, you could use 
commands.getoutput() to read in the result of the 'mount' command and 
parse it.

-- Gerhard

More information about the Python-list mailing list