【发布时间】:2015-06-01 22:11:30
【问题描述】:
我读到here 如下:
注意: 在所有 Python 版本中生成相同的数值,并且 平台使用
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
关于如何将此函数应用于字符串的任何想法?
【问题讨论】:
-
试试
"S89234IX".encode('utf-8')。
标签: python python-3.x hash zlib