mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
12 lines
300 B
Python
12 lines
300 B
Python
|
|
||
|
|
||
|
def filter_dict_by_set(dictionary: dict, valid_keys: set):
|
||
|
""" remove all key value pairs, where key is not in valid_keys set """
|
||
|
new_dictionary = {}
|
||
|
|
||
|
for key, value in dictionary.items():
|
||
|
if key in valid_keys:
|
||
|
new_dictionary[key] = value
|
||
|
|
||
|
return new_dictionary
|