首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
推荐学习书目
›
Learn Python the Hard Way
Python Sites
›
PyPI
- Python Package Index
›
http://diveintopython.org/toc/index.html
›
Pocoo
值得关注的项目
›
PyPy
›
Celery
›
Jinja2
›
Read the Docs
›
gevent
›
pyenv
›
virtualenv
›
Stackless Python
›
Beautiful Soup
›
结巴中文分词
›
Green Unicorn
›
Sentry
›
Shovel
›
Pyflakes
›
pytest
Python 编程
›
pep8 Checker
Styles
›
PEP 8
›
Google Python Style Guide
›
Code Style from The Hitchhiker's Guide
V2EX
›
Python
Python 如何读取光盘内文件信息
cshcool
·
2013-03-22 20:39:02 +08:00
· 3909 次点击
这是一个创建于 4214 天前的主题,其中的信息可能已经有所发展或是发生改变。
需求很简单,就是将光盘内的所有文件名列出,但是用os.listdir函数直接访问光盘的盘符,会出现 代码为234的windows error。
有看到《可爱的Python》这本书里有专门在介绍关于读取光盘的,但他是在Linux环境下通过os.walk('/media/cdrom0') 来获得光盘内容信息
工作环境的关系,我只能在windows下完成这个需求,请问有什么方法吗? 谢谢
光盘
Windows
OS
3 条回复
•
1970-01-01 08:00:00 +08:00
1
Mac
2013-03-22 21:49:16 +08:00
os.walk(r'G:')
2
cshcool
OP
2013-03-23 09:45:32 +08:00
@
Mac
你好,os.walk其他本地磁盘都没问题,就是对光盘的盘符进行os.walk时 没有结果也没报错
3
0x0001
2013-03-23 09:54:24 +08:00
1
可尝试调用cmd的tree命令,我没在Python试过…
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
1619 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 25ms ·
UTC 00:53
·
PVG 08:53
·
LAX 17:53
·
JFK 20:53
Developed with
CodeLauncher
♥ Do have faith in what you're doing.