python获取windows下所有盘符
2016-07-06 08:37
691 查看
import ctypes import os lpBuffer = ctypes.create_string_buffer(78) ctypes.windll.kernel32.GetLogicalDriveStringsA(ctypes.sizeof(lpBuffer), lpBuffer) vol = lpBuffer.raw.split('\x00') for i in vol: print i #遍历字母A到Z,忽略光驱的盘符 for i in range(65,91): vol = chr(i) + ':' if os.path.isdir(vol): print vol
本文出自 “左手右手” 博客,请务必保留此出处http://mofeihu.blog.51cto.com/1825994/1796141
相关文章推荐
- python基础知识和运用
- NBLAST SCORE
- collections
- python变量不能以数字打头详解
- 从零开始学python之hello world
- 从零开始学python之安装配置
- python使用logging进行日志配置
- Python的引用和深拷贝
- python 操作mysql数据库
- Python网页信息采集:使用PhantomJS采集淘宝天猫商品内容
- Python多线程参考资料
- Python程序员写代码时应该避免的16个“坑”
- Python Pandas 分析郁达夫《故都的秋》
- Python面向对象(一)
- 字典
- 打包python源文件为exe文件
- GUI库wxPython学习
- Python 列表生成式
- Python 迭代
- Python 切片