我读了here以下内容:
Note: To generate the same numeric value across all Python versions and platforms use
adler32(data) & 0xffffffff
.
我希望将此应用于以下形式的字符串:"S89234IX"
,但是当我这样做时,我得到:
> 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
对如何将这个函数应用于字符串有什么想法吗?在
data
必须是字节字符串。如果要计算Unicode数据的校验和,则需要将其编码为字节字符串,并且需要确保使用特定的编码。例如,使用UTF-8:相关问题 更多 >
编程相关推荐