Python内置函数(42)——hash
2017-12-29 16:13
78 查看
英文文档:
hash(object)Return the hash value of the object (if it has one). Hash values are integers. They are used to quickly compare dictionary keys during a dictionary lookup. Numeric values that compare equal have the same hash value (even if they are of different types, as is the case for 1 and 1.0).
返回对象的哈希值
说明:
1. 返回对象的哈希值,用整数表示。哈希值在字典查找时,可用于快速比较键的值。
>>> hash('good good study') 1032709256
2. 相等的数值,即使类型不一致,计算的哈希值是一样的。
>>> 1.0 == 1 True >>> hash(1.0) 1 >>> hash(1) 1 >>> hash(1.0000) 1
相关文章推荐
- python常用内置函数hash()
- python内置函数,abc, all, any, bin, bool, bytes, chr, divmod, eval, hash, help, hex, oct, id, instance,等
- Python内置函数(28)——hash
- Python标准库:内置函数hash(object)
- Python标准库:内置函数hash(object)
- Python内置函数(42)——memoryview
- [Python学习笔记][Python内置函数]
- Python基础之内置函数
- python几个内置函数之-filter,map,reduce
- Python hashlib模块 (主要记录md5加密)
- Python3常用内置函数
- Python标准库:内置函数__import__(name, globals=None, locals=None, fromlist=(), level=0)
- 2.6 学python 函数3 内置函数 匿名函数 装饰器1
- Python内置函数(12)——compile
- Python_Day_4(内置函数之篇)
- python内置函数:lambda、map、filter
- Python标准库:内置函数ascii(object)
- python的strip()内置函数,各种string内置函数见link
- Python函数篇(3)-内置函数、文件处理
- python 内置函数map、reduce的使用