os.environ['PYTHONHASHSEED'] = '0'

版权声明:请征得博主同意后,再进行转载 https://blog.csdn.net/qq_34840129/article/details/86094096

主要是为了禁止hash随机化,使得实验可复现。

If this variable is not set or set to random, a random value is used to seed the hashes of str, bytes and datetime objects.

If PYTHONHASHSEED is set to an integer value, it is used as a fixed seed for generating the hash() of the types covered by the hash randomization.

Its purpose is to allow repeatable hashing, such as for selftests for the interpreter itself, or to allow a cluster of python processes to share hash values.

The integer must be a decimal number in the range [0,4294967295]. Specifying the value 0 will disable hash randomization.

猜你喜欢

转载自blog.csdn.net/qq_34840129/article/details/86094096
今日推荐