Skip to content Skip to sidebar Skip to footer

Python 2.x Zlib.decompress Data From Mysql

Can I decompress data in python that compressed from mysql? mysql 5.6 select to_base64(compress('test')); result from mysql BAAAAHicK0ktLgEABF0BwQ== python to decompress >>

Solution 1:

I expect that mysql isn't compressing this the right way (or not with zlib, anyway)

import zlib
import base64
print(base64.b64encode(zlib.compress('test'))) # 'test'.encode() on Python3

Produces:

'eJwrSS0uAQAEXQHB'

Post a Comment for "Python 2.x Zlib.decompress Data From Mysql"