Created
December 12, 2025 19:15
-
-
Save lychees/30bee0af85f3a1f1628eab7243d21445 to your computer and use it in GitHub Desktop.
zlib.compress()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import zlib | |
| import random | |
| #stri = "1ab2ab3ab4ab5ab" | |
| stri = "1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa6bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" | |
| for i in range(10): | |
| li = list(stri) | |
| random.shuffle(li) | |
| print(li) | |
| ranstr = "".join(li) | |
| print(ranstr) | |
| data = bytes(ranstr,'utf-8') | |
| compress_data = zlib.compress(data, 1) | |
| print(len(compress_data)/len(data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment