Partition names with Python

Gerhard Häring gh at ghaering.de
Mon Jun 30 11:39:44 EDT 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 
http://www.faqts.com/knowledge_base/view.phtml/aid/4670/fid/245

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