标签:cio util file pytho os.walk imp test print wal
import os,shutil
newfolder=‘C:\\delicious\\test‘
sourcefolder=‘C:\\delicious‘
os.chdir(sourcefolder)
for folderName, subfolders, filenames in os.walk(sourcefolder):
#print (filenames)
for item in filenames:
if item.endswith(‘.txt‘):
#print(item)
shutil.copy(item , newfolder)
print (‘Copy ‘+ item +‘ to ‘+newfolder )
#else:
#print(‘NONE‘)
python编程快速上手之第9章实践项目参考答案(9.8.1)
标签:cio util file pytho os.walk imp test print wal
原文地址:http://www.cnblogs.com/flying-wyf/p/6718209.html