Repositories
Help
py.lib.aw_web_tools
Commits
Files
Yohn Y.
2024-02-27
Parent:
06f00ec09030
6:41a5e209558a
Go to Latest
py.lib.aw_web_tools/src/aw_web_tools/misc_tools.py
Added tag 0.202402.3 for changeset 4d3b509e0967
Download raw file
View source
Diff to previous
Annotate
History
Loading...
1
# coding: utf-8
2
from
typing
import
Union
,
List
,
Tuple
3
4
5
def
dict_filter
(
data
:
dict
,
need_keys
:
Union
[
List
[
str
],
Tuple
[
str
]])
->
dict
:
6
"""\
7
Создать новый словарь на основе существующего, добавив в него только нужные ключи
8
"""
9
return
dict
((
key
,
val
)
for
key
,
val
in
data
.
items
()
if
key
in
need_keys
)