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  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM