import os,sys
imagedir = 'D:\\PackerImg\\imgDir'
outplistdir = 'D:\\PackerImg\\outDir'
comend = 'TexturePacker'
print "imagedir = %s \n outdir = "%imagedir,outplistdir
herolist = os.listdir(imagedir)
print "heave %d hero convert"%len(herolist)
for n in range(len(herolist)):
herodirtmp = imagedir + os.sep + herolist[n]
print "herodirtmp %s"%herodirtmp
herotmplist = os.listdir(herodirtmp)
cmdtmp = comend
print "hero %s heave image = %d"%(str(herolist[n]),len(herotmplist))
allImage = ""
for im in range(len(herotmplist)):
allImage = allImage + " " + herodirtmp + os.sep + herotmplist[im]
cmdtmp = cmdtmp + " " + allImage +\
" --data " + outplistdir + os.sep + herolist[n] + ".plist"\
" --sheet " + outplistdir + os.sep + herolist[n] + ".png"\
" --format " + "cocos2d"
os.system(cmdtmp)
http://blog.csdn.net/linjf520/article/details/42420471