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

Discussion in 'Python' started by Frank Bechmann, Nov 9, 2003.

  1. 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.
    Frank Bechmann, Nov 9, 2003
    #1
    1. Advertising

  2. 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.
    Nicolas =?ISO-8859-15?Q?Favre=2DF=E9lix?=, Nov 9, 2003
    #2
    1. Advertising

  3. Alex Martelli, Nov 9, 2003
    #3
  4. 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.
    Frank Bechmann, Nov 9, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UHJhZGVlcCBTdW5kYXJhbShNU0ZUKQ==?=

    Enumerate all the drives including Mapped network drives on a serv

    =?Utf-8?B?UHJhZGVlcCBTdW5kYXJhbShNU0ZUKQ==?=, Feb 25, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    1,020
    =?Utf-8?B?UHJhZGVlcCBTdW5kYXJhbShNU0ZUKQ==?=
    Feb 26, 2005
  2. RunLevelZero
    Replies:
    4
    Views:
    459
    Mike Meyer
    Jun 5, 2005
  3. cantabile
    Replies:
    6
    Views:
    517
    cantabile
    Jun 14, 2005
  4. Tim Golden

    Re: List of disk drives on Windows?

    Tim Golden, May 20, 2008, in forum: Python
    Replies:
    3
    Views:
    4,188
    Mike Driscoll
    May 20, 2008
  5. joblack
    Replies:
    0
    Views:
    242
    joblack
    May 3, 2012
Loading...

Share This Page