Enumerating drives

richard_chamberlain richard_chamberlain at ntlworld.com
Mon Jul 10 16:12:41 EDT 2000


Hi Lars,

On Win32 you can use:

import win32api,string

drives=win32api.GetLogicalDriveStrings()
drives=string.splitfields(drives,'\000')
print drives

GetLogicalDriveStrings returns a string with each drive null terminated so
you can use the string module to separate them into a list.

There is also a win32api.GetLogicalDrives() which returns a bitmask where
each bit represents a drive letter, so 1101 (or 13 in decimal) would
represent (going from right to left) a:\,c:\ and d:\.

Richard


Lars Lundstedt <lars.lundstedt at telia.com> wrote in message
news:Syna5.206$967.189230592 at newsb.telia.net...
> Anyone know how to enumerate drives (local and network) in Python?
>
>
> /LasseLu
>
>





More information about the Python-list mailing list