how to get a list of available drives (partitions) in windows

Nicolas Favre-Félix n.favrefelix at __spam__free.fr
Sun Nov 9 06:46:25 EST 2003


from os import *
from os.path import *

def find_drives(env):

    L = []

    if(env == 'WINDOWS'):

        for i in range(ord('a'), ord('z')+1):
            drive = chr(i)

            if(exists(drive +":\\")):
                L.append(drive)

        return L

    elif(environnement == 'UNIX'):

        return L





Frank Bechmann wrote:

> yes, that's the simple question:
> 
> is there some python standard or 'Python for Windows Extensions'
> functionality to iterate or list-return the available drives ('A:',
> 'B:', 'C:', ...) on a machine running windows?
> 
> Thx in advance.





More information about the Python-list mailing list