python 产生随机字符串

来源:互联网 发布:python 仪器控制 编辑:程序博客网 时间:2024/04/18 11:51
import random

import string


new_words = ''.join(random.sample(string.ascii_letters + string.digits,n))

注意:n为需要生成字符的位数

0 0