On May 20, 2:18 pm, Bob Greschke <[EMAIL PROTECTED]> wrote: > This MUST have been asked before, but I can't seem to Google the right > thing. How can I get a list of drives on a Windows box, like ["C:\", > "D:\"], like I can if I do something like listdir("/Volumes") on a Mac? > > Thanks! > > Bob
>>> import os.path >>> dl = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' >>> drives = ['%s:' % d for d in dl if os.path.exists('%s:' % d)] >>> drives ['C:', 'D:', 'F:', 'G:', 'H:', 'I:', 'J:', 'M:', 'N:', 'O:', 'P:', 'Q:', 'R:', 'S:', 'T:', 'U:', 'X:', 'Y:'] -- http://mail.python.org/mailman/listinfo/python-list