python判断&循环实现jenkins中docker模块执行互斥和顺序

chooseSuite = ['a', 'b', 'c', 'd', 'e']        #创建列表(列表中为一个个docker)
firstClass = ['a', 'd', 'e']
secondClass = ['b', 'c']
firstExcute = [] #创建空列表,用于下面存放if执行后的结果
secondExcute = []
for i in chooseSuite: #循环
if i in firstClass: #判断:如果i在firstClass列表中
firstExcute.append(i) #则把i放进firstExcute列表下
elif i in secondClass:#判断:如果i在secondClass列表中
secondExcute.append(i) #则把i放进secondExcute列表中
for excuteStuite in (firstExcute, secondExcute):#依次循环遍历firstExcute、secondExcute列表中的值(也就是docker)
print(excuteStuite) #输出遍历结果,首次为firstExcute列表中所有值,也就是firstClass列表中所有值;第二次遍历为secondClass列表中所有值,也就是secondClass列表中所有值
for i in excuteStuite:
print(i)
posted @ 2021-05-11 18:07  黄黄可爱  阅读(80)  评论(0编辑  收藏  举报