python的os.urandom 的用途

来源:互联网 发布:淘宝网店怎么实名认证 编辑:程序博客网 时间:2024/05/16 10:29

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 indexE'>>> index = os.urandom(2)>>> print index€H>>> index = os.urandom(2)>>> print indexI?>>> index = os.urandom(2)>>> print index??


0 0