美文网首页
python 生成随机字符串

python 生成随机字符串

作者: 灰太狼256 | 来源:发表于2021-02-08 17:06 被阅读0次
    import random
    
    def setRandomStr():
        arr = ['a','b','c','d','e','f','0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','0','1','2','3','4','5','6','7','8','9']
        randomStr = "".join(random.sample(arr, 32))
        
        return randomStr
    
    randomStr = setRandomStr()
    print(randomStr)
    

    相关文章

      网友评论

          本文标题:python 生成随机字符串

          本文链接:https://www.haomeiwen.com/subject/zfhfxltx.html