检索windows中的当前驱动器号(来自python)[复制]

时间:2021-11-27 10:46:30

Possible Duplicate:
Is there a way to list all the available drive letters in python?

可能重复:有没有办法列出python中所有可用的驱动器号?

What's the way to retrieve currently mounted drive list in Windows incl. Thumb drives, and mapped networks.

在Windows中检索当前安装的驱动器列表的方法是什么?拇指驱动器和映射网络。

i currently do

我现在这样做

    drives=[]
    for c in string.lowercase:
        if os.path.isdir(c+':'):
            drives.append(c+':')

which looks ugly, but is completely KISS proof :)

看起来很难看,但完全可以证明:)

1 个解决方案

#1


win32api.GetLogicalDriveStrings().split("\x00")

#1


win32api.GetLogicalDriveStrings().split("\x00")