Try to search your question here, if you can't find : Ask Any Question Now ?

search an array element in other 2d list and count sublists in python

HomeCategory: stackoverflowsearch an array element in other 2d list and count sublists in python
Avatarcraig asked 2 years ago

I’m new in python,
I have a list like : A=['a','b','c']
and a list like B=[['a','c'],['a','c'],['b','b']]
i want to have a list like C=[2,1,2]
C stores occurrence of sublists that each element of A comes in B
that means ‘a’ is in 2 sublists
‘b’ is in 1 sublist
and ‘c’ is in 2 sublists,
how can I achieve this?
thanks

1 Answers
Best Answer
AvatarJyoti answered 2 years ago
Your Answer

5 + 13 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com