标签:glob close python str file open pen import jpg
import os
import glob
localDir = ‘F:/test/test1/‘
file_test = open(localDir + ‘file_test.txt‘,‘w‘)
os.chdir(localDir)
for file_name in glob.glob(‘*.jpg‘):
#print (file_name)
file_test.write( ‘test1/‘ + str(file_name) + ‘\n‘)
file_test.close()
标签:glob close python str file open pen import jpg
原文地址:http://www.cnblogs.com/wang0331/p/7062149.html