出于缓存目的,我需要从dict中存在的GET参数生成缓存键.
目前我正在使用sha1(repr(sorted(my_dict.items())))(sha1()是一种在内部使用hashlib的便捷方法),但我很好奇是否有更好的方法.
sha1(repr(sorted(my_dict.items())))
sha1()
python hash dictionary
dictionary ×1
hash ×1
python ×1