# 输出目录下的文件 os模块 分类: python 小练习 2013-05-13 18:01 205人阅读 评论(0) 收藏
#coding:utf-8
import os
dirname = 'D:\\'
li=[f for f in os.listdir(dirname)]
print li
for f in li:
if os.path.isfile(os.path.join(dirname,f)):
print os.path.join(dirname,f)
import os
dirname = 'D:\\'
li=[f for f in os.listdir(dirname)]
print li
for f in li:
if os.path.isfile(os.path.join(dirname,f)):
print os.path.join(dirname,f)
版权声明:本文为博主原创文章,未经博主允许不得转载。