Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. def check_dict_common_keys(dict_list):
  2. """
  3. check the dict common keys in the dict list
  4. :param dict_list: [{},{}...]
  5. :return: set()
  6. """
  7. if len(dict_list) >= 2:
  8. common_keys = set(dict_list[0].keys())
  9. for dict_item in dict_list[1:]:
  10. common_keys.intersection_update(set(dict_item.keys()))
  11. return common_keys
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement