有没有办法列出所有可用的 Windows 驱动器? [英] Is there a way to list all the available Windows' drives?

查看:47
本文介绍了有没有办法列出所有可用的 Windows 驱动器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Python 有没有办法列出 Windows 系统中所有当前正在使用的驱动器号?

Is there a way in Python to list all the currently in-use drive letters in a Windows system?

(我的 Google-fu 似乎让我失望了)

(My Google-fu seems to have let me down on this one)

A C++ 等效:枚举所有可用驱动器Windows 中的字母

推荐答案

import win32api

drives = win32api.GetLogicalDriveStrings()
drives = drives.split('\000')[:-1]
print drives

改编自:http://www.faqts.com/knowledge_base/view.phtml/aid/4670

这篇关于有没有办法列出所有可用的 Windows 驱动器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆