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