Python日记_os.urandom

Python中os.urandom(n)的作用

随即产生n个字节的字符串,可以作为随机加密key使用~

>>> index = os.urandom(2)  
>>> print index  
墿  
>>> index = os.urandom(2)  
>>> print index  
氡  
>>> index = os.urandom(2)  
>>> print index  
Ε  
>>> index = os.urandom(2)  
>>> print index  
E'  
>>> index = os.urandom(2)  
>>> print index  
€H  
>>> index = os.urandom(2)  
>>> print index  
I?  
>>> index = os.urandom(2)  
>>> print index  
原文地址:https://www.cnblogs.com/ne-zha/p/7500979.html