安装
pip install lzstring
import lzstring
ic = {"name": "root", "password": "123456"}
x = lzstring.LZString()
compressed = x.compressToBase64(str(ic))
print(compressed)
decompressed = x.decompressFromBase64(compressed)
print(decompressed)
打印内容
N4cgdghgtgpiBcACEAnA9mgLiANMgDhAM5EDuaKAJgsgIwBMAzACwCsAbCAL5A==
{'name': 'root', 'password': '123456'}