#coding=utf-8 import os import shutil fobj = open('F:/v3/k.txt','r') line = fobj.readline() while line: if line.find('a') >=0 : line = line.strip('\n') line = line.split(' ') line = line[-1] smd5 = line.split('\\') smd5 = smd5[-1] print(line) if os.path.exists(line): newplace='F:/v3/manual/a/' #print(newplace+smd5) shutil.move(line,newplace+smd5) elif line.find('b') >= 0 : line = line.strip('\n') line = line.split(' ') line = line[-1] print(line) smd5 = line.split('\\') smd5 = smd5[-1] if os.path.exists(line): newplace='F:/v3/manual/b/' #print(newplace+smd5) shutil.move(line,newplace+smd5) line = fobj.readline() fobj.close() print('over')