标签:python
#!/bin/usr/python import os import sys import subprocess filenum = open(‘/python/photolist‘,‘r+‘) list1 = [] photofile = [] for line in filenum.readlines(): line = line.strip(‘\n‘) list1.append(line) filenum.close() for filenames in os.walk(‘/photo/photo‘): photofile.extend(filenames[2]) count = 0 for ele in photofile: if ele[4:8] in list1: str = ‘/photo/photo/‘ + ele print str count += 1 subprocess.call([‘cp‘,str,‘/photo1‘]) else: pass print count ~
标签:python
原文地址:http://hifour.blog.51cto.com/2733096/1786839