标签:blog os div line log python ad ef
import os import shutil def ProcessStr(path, flag): line = path.strip(‘\n‘) line = line.split() fullpath = line[0] fullpath = fullpath[:49] sha1 = fullpath[13:49] if os.path.exists(fullpath): pass else: return if(1 == flag): shutil.move(fullpath, os.path.join(‘f:\\s1\\‘,sha1)) elif(2 == flag): shutil.move(fullpath, os.path.join(‘f:\\s2\\‘,sha1)) elif(3 == flag): shutil.move(fullpath, os.path.join(‘f:\\s3\\‘,sha1)) elif(4 == flag): shutil.move(fullpath, os.path.join(‘f:\\s4\\‘,sha1)) elif(5 == flag): shutil.move(fullpath, os.path.join(‘f:\\s5\\‘,sha1)) elif(6 == flag): shutil.move(fullpath, os.path.join(‘f:\\s6\\‘,sha1)) def MoveF(): fobj = open(‘d:\\tmp.txt‘,‘r‘) line = fobj.readline() while line: line = line.strip(‘\n‘) if(line.find(‘a‘) != -1): ProcessStr(line,1) elif(line.find(‘b‘) != -1): ProcessStr(line,1) elif(line.find(‘c‘) != -1): ProcessStr(line,1) elif(line.find(‘d‘) != -1): ProcessStr(line,1) elif(line.find(‘e‘) != -1): ProcessStr(line,2) elif(line.find(‘f‘) != -1): ProcessStr(line,3) elif(line.find(‘g‘) != -1): ProcessStr(line,4) elif(line.find(‘h‘) != -1): ProcessStr(line,5) elif(line.find(‘i‘) != -1): ProcessStr(line,5) elif(line.find(‘j‘) != -1): ProcessStr(line,6) elif(line.find(‘k‘) != -1): ProcessStr(line,6) else: print(line) line = fobj.readline() fobj.close() if __name__ == "__main__": MoveF()
标签:blog os div line log python ad ef
原文地址:http://www.cnblogs.com/xiaobaichuangtianxia/p/3907193.html