I read here the following:
Note: To generate the same numeric value across all Python versions and platforms use
adler32(data) & 0xffffffff
.
I am hoping to apply this to a string of the form: "S89234IX"
, but when I do so, I get:
> zlib.adler32("S89234IX")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-9-84eee14d45ae> in <module>()
----> 1 zlib.adler32(campaigns_to_work_with[0])
TypeError: 'str' does not support the buffer interface
Any thoughts on how to apply this function to a string?
data
must be a byte string. If you want to compute a checksum of Unicode data, you will need to encode it to a byte string, and you will need to make sure to stick with a specific encoding. For example, using UTF-8:
checksum = zlib.adler32("S89234IX".encode('utf-8')) & 0xffffffff
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With