My parent dictionary is below
d = [{"code":1, "description":"This is only one %s", "name":"Hello"}, "code":2, "description":"This %s has one more %s", "name":"World"}]
My input {'code':1, 'details':['A']}
Expected out {"description":"This is only one A", "name":"Hello"}
My input {'code':2, 'details':['A','B']}
Expected out {"description":"This A has one more B", "name":"World"}
- There is
%s
in the description - it has to replace by the values inside the
details
key
没有评论:
发表评论