## imgList.py
import os,sys,re
import shutil,string
baseLen = len(os.getcwd())
#[1]
def getList(dirname,pFunc):
try:
ls=os.listdir(dirname)
except:
print dirname,'is access deny'
else:
for file in ls:
temp = os.path.join(dirname,file)
if(os.path.isdir(temp)):
getList(temp,pFunc)
else:
pFunc(dirname,file)
#[2]
def toImage(dirname,file):
newPath = dirname[baseLen:]
if newPath[0] == "/":
newPath = newPath[1:]
print '
' % (newPath)
getList(os.getcwd(),toImage)
@@用法说明
imgList.py
生成图像列表格式列表