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
Post a Comment