import os, csv
f=open("C:\\tempa\\file.csv", 'wb') #write to an existing blank csv file
w=csv.writer(f)
for path, dirs, files, in os.walk("C:\\tempa"):
for filename in files:
w.writero
import os
import sys
rootdir = sys.argv[1]
print os.path.abspath(rootdir)
with open('output.txt','r') as fout:
for root, subFolders, files in os.walk(rootdir):
for file in files:
到目前爲止,下面的代碼一直沒有什麼,但倔強: for root,subdirs,files in os.walk(topDir):
for fileName in files:
if fileName.endswith(("0.tif","0.png")):
images.update({fileName[:-5]:Image(fileName,origin)}
我開始與一些代碼,我從another stackoverflow question得生成目錄樹中的所有文件完整路徑: import os
def recursive_file_gen(mydir):
for root, dirs, files in os.walk(mydir):
for file in files:
yield os.path.join(ro