Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- l1= [[a,b,c,x,y,z],[a,b,c,x,y,z],[a,b,c,x,y,z],...]
- l2= [z,b,c]
- while True:
- if ...
- break
- l2 = [1,4,20]
- l1= [[1,2,3,4,5,6],[7,8,9,10,11,12],[13,14,15,16,17,18]]
- l2= [18,14,15]
- res1 = [ x for x in l1 if l2 == x[5:6]+x[1:3] ]
- res2 = [ x for x in l1 if l2 == x[5:6]+x[1:2] ]
- for item in l1:
- здесь выполняем проверку на совпадение
- #!/usr/bin/env python
- from collections import namedtuple
- Map = namedtuple('Map', 'a,b,c,x,y,z')
- l1 = [[a,b,c,x,y,z],[a,b,c,x,y,z],[a,b,c,x,y,z],...]
- l2 = [1, 4, 20]
- z, b = l2[:2] # reference
- found_maps = [m for m in map(Map, l1) if z == m.z and b == m.b]
- found = next((m for m in map(Map, l1) if z == m.z and b == m.b), None)
- l1 = [[1,4,2,7,3,5],[1,8,9,2,5,3,7],[3,2,1,5]]
- res = None
- for item in l1:
- if 4 in item and 7 in item:
- res = item
- for item in l1:
- if (l2[0] in item) and (l2[1] in item):
- res = item
- res = []
- for item in l1:
- if (l2[0] in item) and (l2[1] in item):
- res.append(item)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement