使用 Python 如何生成 10个随机激活码

来源:互联网 发布:结构的刚度矩阵 编辑:程序博客网 时间:2024/05/16 05:37

使用python产生10个随机的激活码,包含大小写字母及数字0-9,长度均为20。


所包含的字母数字表达式:

import stringselectWord = string.ascii_letters  + "0123456789"


附上代码:

import randomimport stringselectWord = string.ascii_letters  + "0123456789"def res(count, length):# count = 10# len = 20for x in range(count):re = ""for y in range(length):re += random.choice(selectWord)print (re)if __name__ == '__main__':res(10, 20)







阅读全文
0 0