Serialization/deserialization of iterables of type 'str' to a single string.
Project description
iterable-serialization
Serialization/deserialization of iterables of type str.
This package aims to be a better version of:
serialized = "|".join(("a", "b", "c"))
print(serialized)
# a|b|c
deserialized = serialized.split("|")
print(deserialized)
# ['a', 'b', 'c']
It makes it possible to serialize/deserialize an iterable with occurring symbols as separator:
serialized = serialize_iterable(("a", "b", "c"), "a")
print(serialized)
# aabac
deserialized = deserialize_iterable(serialized, "a")
print(list(deserialized))
# ['a', 'b', 'c']
With the version above, it would result in a wrong deserialization result:
serialized = "a".join(("a", "b", "c"))
print(serialized)
# aabac
deserialized = serialized.split("a")
print(list(deserialized))
# ['', '', 'b', 'c']
Installation
pipenv install -e git+https://github.com/stefantaubert/iterable-serialization.git@master#egg=iterable_serialization
Usage
from iterable_serialization import deserialize_iterable, serialize_iterable
serialized = serialize_iterable(("a", "b", "c"), "a")
print(serialized)
# aabac
deserialized = deserialize_iterable(serialized, "a")
print(list(deserialized))
# ['a', 'b', 'c']
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 iterable-serialization-0.0.1.tar.gz.
File metadata
- Download URL: iterable-serialization-0.0.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29dd698e6537fde4361a2ba360ec98b4922003f4c177fd4d5db75fa78e087386
|
|
| MD5 |
34478f817eed9bbe8bbeebd0645e07d5
|
|
| BLAKE2b-256 |
e224c97e6f2470e072596a11036a151b2e34079a43f1468236d143a6226ffcc4
|
File details
Details for the file iterable_serialization-0.0.1-py3-none-any.whl.
File metadata
- Download URL: iterable_serialization-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfe3eb07287085a3051235c5b4acd0daa98b4af8c97c66b1395ecb849ea2eb38
|
|
| MD5 |
72a557b97ada2632bba65a73a91ca33e
|
|
| BLAKE2b-256 |
95f99bb5fa5db4756fa9a4408da072fdaaaae86e0ac52cd71b6cca3f857efb46
|