zip and zip_longest for dict
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dict_zip-0.7.0.tar.gz.
File metadata
- Download URL: dict_zip-0.7.0.tar.gz
- Upload date:
- Size: 36.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec743d43ace73cfe338965b17b999bda87351cd9fcd50c18e33406dc074af7e0
|
|
| MD5 |
085d648f33b0d176c7ebf315ede37758
|
|
| BLAKE2b-256 |
4b976a03205bd5f17a0c8d39695d43f5af651f6ba5e47ccbbe8c93dfb5cfd614
|
File details
Details for the file dict_zip-0.7.0-py3-none-any.whl.
File metadata
- Download URL: dict_zip-0.7.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69166f33d0edccd8f8733292eba7136164fc7ee8288665e50530ddba016feb5a
|
|
| MD5 |
c8c646648d08cdbd026bc9aab6863ad4
|
|
| BLAKE2b-256 |
f50d40f05591cfa11cb77279e94fb69f2a7549d72e76854b534051989bc60ac3
|