taskMap=[]
projectMap=[]
taskMap.append({'id':1,'name':'huawei'})
taskMap.append({'id':2,'name':'mingjian'})
projectMap.append({'id':1,'name':'huawei'})
for task_item in taskMap:
if task_item['id'] != projectMap[0]['id']:
print task_item
#还可以这样:
from multiprocessing.dummy import Pool#多核运行模块,线程池,提高性能
taskMap=[]
projectMap=[]
taskMap.append({'id':1,'name':'huawei'})
taskMap.append({'id':2,'name':'mingjian'})
projectMap.append({'id':1,'name':'huawei'})
def find_item(task_item):
if task_item not in projectMap:
print task_item
pool = ThreadPool()
pool.map(find_item,taskMap)#实现多线程运行,map自动依据taskMap序列中的元素自动传递给函数
pool.close()
pool.join()