python 生成随机字符串

2021-02-08  本文已影响0人  灰太狼256
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)
上一篇下一篇

猜你喜欢

热点阅读