Electrons_Ahoy Electrons_Ahoy - 1 year ago 90
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.)

Related:


Answer Source
import win32api

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

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