顺序生成字母数字字符串

顺序生成字母数字字符串,第1张

顺序生成字母数字字符串
from string import digits, ascii_uppercase, ascii_lowercasefrom itertools import productchars = digits + ascii_uppercase + ascii_lowercasefor n in range(1, 4 + 1):    for comb in product(chars, repeat=n):        print ''.join(comb)

首先,将所有数字,大写字母和小写字母组成一个字符串。

然后,对于1-4中的每个长度,它将打印这些数字和字母的所有可能组合。

请记住,这是很多组合-62 ^ 4 + 62 ^ 3 + 62 ^ 2 + 62。



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5652412.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存