Huffman compression and decompression (Pure Python implementation)
Project description
Usage
from pyhuff import compress
text=b'A'*100
print(text) # b'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
comp=compress(text)
print(comp) # b'\x041\x00A\x010\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Or use:
pyhuff compress in.txt out.bin
pyhuff decompress out.bin dec.txt
Disadvantages
- The code is very messy because of compatibility of Python 2 (And I don't know the six package).
- Decompression is very slow.
- Not very good, sometimes the compressed file is larger than the original one.
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
PythonHuff-1.0.3.tar.gz
(3.5 kB
view details)
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 PythonHuff-1.0.3.tar.gz.
File metadata
- Download URL: PythonHuff-1.0.3.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9214129ac1fd8d7b4e9f99170baa6f104ffee281a5c5bccf0f682898368370b8
|
|
| MD5 |
52e51eb090f2811b84742defa4d06361
|
|
| BLAKE2b-256 |
590c939a6ac934e67bcb030afcf50dd1bbdf6d737ab70079400a769a6d09ac15
|
File details
Details for the file PythonHuff-1.0.3-py3-none-any.whl.
File metadata
- Download URL: PythonHuff-1.0.3-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bd7a1b0a7585c9a790b27056b0af313730e3738a36355c43394f6281e50c896
|
|
| MD5 |
26cb9663c64d81bf0bbd0281849673b1
|
|
| BLAKE2b-256 |
1c805b1efc65b43987076b54d3210765690dc52555f5e0b93004fec41698a208
|