Electrons_Ahoy Electrons_Ahoy - 9 months ago 59
Python Question

Is there a way to list all the available drive letters in python?

More or less what it says on the tin: is there an (easy) way in Python to list all the currently in-use drive letters in a windows system?

(My google-fu seems to have let me down on this one.)


import win32api

drives = win32api.GetLogicalDriveStrings()
drives = drives.split('\000')[:-1]
print drives

Adapted from: http://www.faqts.com/knowledge_base/view.phtml/aid/4670