import os
searchFolder = '/Users/bubble/Desktop/pics'
for root, dirs, files in os.walk(searchFolder):
for file in files:
pathName = os.path.join(root,file)
print pathName
print os.path.getsize(pathName)
print
f = open('/Users/bubble/Desktop/workfile.txt','w')
f.write(pathName)
只有一行被打印到文本文件:/Users/bubble/Desktop/pics/IMG_2999.JPG
我希望将整个输出打印到一个文本文件中(也许稍后,甚至是一个我可以编辑的 html 文件看起来很漂亮)
谢谢