标签:
import os dir = ‘D:/hero/Classes‘ def readfile(dir): str="" first_line=1 for f in os.listdir(dir): file = os.path.join(dir, f) if os.path.isdir(file): readfile(file) elif os.path.isfile(file): newfile=file basename=os.path.basename(newfile) backsuf=basename.split(‘.‘)[-1] if backsuf=="cpp": if first_line==1: str+=" ../../Classes/"+basename first_line=0 else: str+="\\"+"\n"+" ../../Classes/"+basename print str return str str_to_write=readfile(dir) file = open(‘Android.mk‘, ‘w‘) file.write(str_to_write) file.close()
标签:
原文地址:http://www.cnblogs.com/yufenghou/p/4175114.html