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

F

Frank Bechmann

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.
 
N

Nicolas =?ISO-8859-15?Q?Favre=2DF=E9lix?=

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
 
F

Frank Bechmann

thx for the quick help!

seemed to be a problem that's not easy to be googled.

and sorry in advance for the double-post which will show up soon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top