python - How to match two arrays -


i have 2 arrays

a = [a, b, c, d] 

and

b = [a1, a2, b1, b2, b3, c1, c2, c3, d1, d2, d3, d4] 

i want match between 2 arrays.

match result:

[a : a1, a2] [b : b1, b2, b3] [c : c1, c2, c3] [d : d1, d2, d3, d4] 

in pretty python:

di = {} item in a:     di[item] = filter(lambda v: v.startswith(item), b) 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -