a = []
for i in ['w','c','li']:
for j in ['z','y','liu']:
if i == 'w' and j == 'z':
print('not match',i,j)
elif i == 'li' and j == 'z' or i == 'li' and j == 'liu':
print('not match',i,j)
elif i == 'li' and j == 'y':
print('match',i,j)
a.append((i,j))
elif i == 'w' and j == 'liu':
print('match',i,j)
a.append((i,j))
elif i == 'c' and j == 'z':
print('match',i,j)
a.append((i,j))
print(a)
输出:
>>> ================================ RESTART ================================
>>>
not match w z
match w liu
match c z
not match li z
match li y
not match li liu
[('w', 'liu'), ('c', 'z'), ('li', 'y')]
>>>
温馨提示:答案为网友推荐,仅供参考