list
ks = ["","","","","aaa","bbb","aa","bb"]
fz = ["","","",""]
:
result = {"": ["", "aa"]}, "": ["", "bbb"], "": ["", "bb"], "": ["", "aaa"]}
?
====================================================
:
-sharpencoding=utf-8
import json
d = {}
ks = ["","","","","aaa","bbb","aa","bb"]
fz = ["","","",""]
kk = []
for key in ks:
for fenzu in fz:
if fenzu in key:
print fenzu,key
kk.append({fenzu:key})
dic = {}
for _ in kk:
for k, v in _.items():
dic.setdefault(k, []).append(v)
print json.dumps([{k:v} for k, v in dic.items()], ensure_ascii=False)