Advertisement
Guest User

Untitled

a guest
May 17th, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1.     for bid in bids:
  2.  
  3.         new_dict = defaultdict(lambda: defaultdict(list))
  4.         list_of_dicts = [_dict for _dict in bid["Search"]["AuctionBids"]["AuctionBidItems"] if isinstance(_dict, dict)]
  5.  
  6.         for _dict in list_of_dicts:
  7.             for key, value in _dict.items():
  8.                 if isinstance(value, dict):
  9.                     for inner_key, inner_value in value.items():
  10.                         new_dict[key][inner_key].append(inner_value)
  11.  
  12.         print(new_dict)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement