python读取文件中的路径内容,保存到另外的路径中
1 #encoding=utf-8 2 import os 3 import os.path 4 import shutil 5 6 def moveFileto(sourceDir, targetDir): 7 shutil.copy(sourceDir, targetDir) 8 9 10 target = raw_input('targetDir') 11 12 filename = raw_input('enter pathfile name:') 13 fobj = open(filename,'r') 14 for x in fobj: 15 print x; 16 source = x.strip('\n') #去除行尾\n 17 moveFileto(source,target) 18 19 fobj.close()