How to select a serie of sublists according to an other list
One more time this is certainly the result of my lack of expertise in programming but I encounter the following problem.
I have a list of lists
A=[[3, 2, 1, 1, 0, 0, 0, 5], [4, 3, -1, 0, -1, 1, 0, 4], [1, 2, 2, 0, 0, 0, 1, 2]]
and an other list
B=[3,5]
What I want is to select a sublist of the list A according to the following criterion : keep the sublist A[i]
if A[i][j]==1 for j in B
This is a bit ambiguous, as revealed by the proposed answer: do you mean "for all j in B" or "for some j in B"?