import os
for dirpath, dirnames, filenames in os.walk(dir):
outfile = open(r'D:\source\uplus_work\res\picture.txt', 'w')
#print filenames
for filename in filenames:
if filename.endswith('.png'):
n = os.path.splitext(filename)[0]
print n
outfile.write(n + '\n')
outfile.close()
import sys
for dirpath, dirnames, filenames in os.walk(dir):
outfile = open(r'D:\source\uplus_work\res\picture.txt', 'w')
#print filenames
for filename in filenames:
if filename.endswith('.png'):
n = os.path.splitext(filename)[0]
print n
outfile.write(n + '\n')
outfile.close()