Python中os.urandom(n)的作用
随机产生n个字节(0-255)的字符串,可以作为随机加密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
- ??