FilterDict-0.2.1576267427
توضیحات
Store data in JSON format
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | FilterDict-0.2.1576267427 |
| نام | FilterDict |
| نسخه کتابخانه | 0.2.1576267427 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Julian Kimmig |
| ایمیل نویسنده | julian-kimmig@gmx.net |
| آدرس صفحه اصلی | https://github.com/JulianKimmig/filter_dict |
| آدرس اینترنتی | https://pypi.org/project/FilterDict/ |
| مجوز | - |
A simple function to generate a simple filtered dict where a dict is created based on a dictionary and a function.
The returned dict contains all the kwargs if the passed function which are present in the inut dict.
This is espacially useful if you have a dict with more keys than needed to call a function or you call a function by reference and want to pass an dict as kwargs
Example:
```
d = dict(a=0,b=1,s1="foo",s2="bar")
def merge_strings(s1="",s2=""):
return s1+s2
print(merge_strings(**d))
#throws TypeError: merge_strings() got an unexpected keyword argument 'a'
print(merge_strings(**filter_dict(d,merge_strings)))
# returns foobar as expected
```
نحوه نصب
نصب پکیج whl FilterDict-0.2.1576267427:
pip install FilterDict-0.2.1576267427.whl
نصب پکیج tar.gz FilterDict-0.2.1576267427:
pip install FilterDict-0.2.1576267427.tar.gz