zoukankan      html  css  js  c++  java
  • python的os.urandom 的用途

    Python中os.urandom(n)的作用

    随机产生n字节(0-255)的字符串,可以作为随机加密key使用~

     

     

    [python] view plain copy
    1. >>> index = os.urandom(2)  
    2. >>> print index  
    3. 墿  
    4. >>> index = os.urandom(2)  
    5. >>> print index  
    6. 氡  
    7. >>> index = os.urandom(2)  
    8. >>> print index  
    9. Ε  
    10. >>> index = os.urandom(2)  
    11. >>> print index  
    12. E'  
    13. >>> index = os.urandom(2)  
    14. >>> print index  
    15. €H  
    16. >>> index = os.urandom(2)  
    17. >>> print index  
    18. I?  
    19. >>> index = os.urandom(2)  
    20. >>> print index  
    21. ?? 
  • 相关阅读:
    编程心得5
    编程心得2
    心得2
    心得1
    7-11
    7-13
    7-9
    7-8
    7-12
    7-14
  • 原文地址:https://www.cnblogs.com/changbaishan/p/8522042.html
Copyright © 2011-2022 走看看