hash() 메서드는 객체의 해시 값이 있는 경우 해당 값을 반환합니다.
해시 값은 사전을 빨리 찾는 동안 사전 키를 비교하는 데 사용되는 정수일 뿐입니다.
객체의 해시 값을 반환합니다.
# hash for integer unchanged print('Hash for 181 is:', hash(181)) # hash for decimal print('Hash for 181.23 is:',hash(181.23)) # hash for string print('Hash for Python is:', hash('Python'))
결과
Hash for 181 is: 181 Hash for 181.23 is: 530343892119126197 Hash for Python is: 2230730083538390373
© 2022 pinfo. All rights reserved.