Enumerating drives in Python or wxPython

Neil Hodgson neilh at scintilla.org
Wed Jul 12 01:11:54 EDT 2000


> Yes, well, I figured that...the problem is that I don't want to use
> PythonWin which as far as I know is the only way to get access to COM...

   There is a distinction between the Win32 extensions and PythonWin. While
they both come in one package, you can use the Win32 extensions from the
safety and convenience of the the Python command line. No need to GUI.

   So, I'll repeat Richard's code and copy it to your email in the hope that
telia is better at email than usenet.

import win32api,string

drives=win32api.GetLogicalDriveStrings()
drives=string.splitfields(drives,'\000')
print drives

   Looks like it gets one too many elements - the last is empty.

   Neil






More information about the Python-list mailing list