在Python代码中求CRC值,要import binascii
binascii.crc32(v) 求出了v的crc32值,这是一个long型,形如-1456387L,把这个值&0xffffffff得到的值形如48a213L的形式。
然后,把这个值用16进制表示出来。www.linuxidc.com
例子:
def _crc32(self, v):
"""
Generates the crc32 hash of the v.
@return: str, the str value for the crc32 of the v
"""
return '0x%x' % (binascii.crc32(v) & 0xffffffff) #取crc32的八位数据 %x返回16进制
Python解析xml文档实例 http://www.linuxidc.com/Linux/2012-02/54760.htm
《Python核心编程 第二版》.(Wesley J. Chun ).[高清PDF中文版] http://www.linuxidc.com/Linux/2013-06/85425.htm
《Python开发技术详解》.( 周伟,宗杰).[高清PDF扫描版+随书视频+代码] http://www.linuxidc.com/Linux/2013-11/92693.htm
Python脚本获取Linux系统信息 http://www.linuxidc.com/Linux/2013-08/88531.htm
在Ubuntu下用Python搭建桌面算法交易研究环境 http://www.linuxidc.com/Linux/2013-11/92534.htm
Python 语言的发展简史 http://www.linuxidc.com/Linux/2014-09/107206.htm
Python 的详细介绍:请点这里
Python 的下载地址:请点这里
本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-01/111127.htm
