how on earth do i get a drive list?

Ken Seehof kens at sightreader.com
Thu Jul 26 16:32:40 EDT 2001


import string, os

def drives():
    d = []
    for c in string.lowercase:
        if os.path.exists('%s:/'%c):
            d.append('%s:'%c)
    return d


>>> drives()
['a:', 'c:', 'd:', 'g:']

Cheers,
- Ken Seehof

----- Original Message -----
From: "G. Willoughby" <thecalm at NOSPAM.btinternet.com>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Thursday, July 26, 2001 12:23 PM
Subject: how on earth do i get a drive list?


> how on earth do i get a drive list? i've been searching for a command to
> display a tuple or list containing all available drives, but i can't find
> it! is it just me or are the standard python docs quite confusing. oh well
> any ideas out there?
>
> G. Willoughby
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list