Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = {'x': [1,2,3], 'y': 1, 'z': set([1,2,3]), 'w': 'qweqwe', 't': {'a': [1, 2]}, 'm': [1]}
- b = {'x': [4,5,6], 'y': 4, 'z': set([4,2,3]), 'w': 'asdf', 't': {'a': [3, 2]}, 'm': "wer"}
- {'x': [1,2,3,4,5,6], 'y': 5, 'z': set([1,2,3,4]), 'w': 'qweqweasdf', 't': {'a': [1, 2, 3, 2]}, 'm': ([1], "wer")}
- for key in a.keys():
- if type(a[key]) is type(b[key]):
- if type(a[key]) is list or type(a[key]) is int or type(a[key]) is str:
- lis = a[key] + b[key]
- dicty[key] = lis
- elif type(a[key]) is set:
- lis = list(a[key]) + list(b[key])
- dicty[key] = set(lis)
- elif type(a[key]) is dict:
- # print func1(a[key],b[key])
- dicty(a.items() + b.items())
- else:
- dicty[key] = tuple(a[key]) + tuple(b[key])
- return dicty
Add Comment
Please, Sign In to add comment