dict_zip
zip and zip_longest for dict.
Installation
$ pip install dict-zip
Usage
dict_zip
dict_zip is zip for dict.
>>> from dict_zip import dict_zip
>>> dict_zip({'a': 1, 'b': 2}, {'a': 3, 'b': 4})
{'a': (1, 3), 'b': (2, 4)}
dict_zip_longest
dict_zip_longest is zip_longest for dict.
It fills with fillvalue (default: None) when argument dict doesn't have match key.
>>> from dict_zip import dict_zip_longest
>>> dict_zip_longest({'a': 1, 'b': 2, 'c': 4}, {'a': 3, 'b': 4})
{'a': (1, 3), 'b': (2, 4), 'c': (4, None)}
map_keys, map_values, map_items
map_keys, map_values, and map_items are used to map keys, values, and items of dict.
>>> from dict_zip import map_keys
>>> map_keys({'a': 1, 'b': 2}, str.upper)
{'A': 1, 'B': 2}
>>> from dict_zip import map_values
>>> map_values({'a': 1, 'b': 2}, str)
{'a': '1', 'b': '2'}
>>> from dict_zip import map_items
>>> map_items({'a': 1, 'b': 2}, str.upper, str)
{'A': '1', 'B': '2'}
tuple_keys
tuple_keys is used to convert dict keys to tuple.
>>> from dict_zip import tuple_keys
>>> tuple_keys({'a': 1, 'b': 2})
{('a',): 1, ('b',): 2}
Type hints
dict_zip supports for type hints.
LICENSE
The 3-Clause BSD License. See also LICENSE file.
Release files for dict-zip 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dict_zip-0.7.0.tar.gz | 36.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dict_zip-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.9 kB
Release files / dict_zip-0.7.0.tar.gz
| Download URL | dict_zip-0.7.0.tar.gz |
|---|---|
| Size | 36.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec743d43ace73cfe338965b17b999bda87351cd9fcd50c18e33406dc074af7e0
|
|
BLAKE2b-256 checksum How to use checksums |
4b976a03205bd5f17a0c8d39695d43f5af651f6ba5e47ccbbe8c93dfb5cfd614
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / dict_zip-0.7.0-py3-none-any.whl
| Download URL | dict_zip-0.7.0-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69166f33d0edccd8f8733292eba7136164fc7ee8288665e50530ddba016feb5a
|
|
BLAKE2b-256 checksum How to use checksums |
f50d40f05591cfa11cb77279e94fb69f2a7549d72e76854b534051989bc60ac3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|