Python生成随机密码
import random
M = int(input("请输入需要生成的密码个数:"))
N = int(input("请输入密码的位数:"))
#提前设定的密码取值范围
codes = 'abcdefghijklimnopqrstuvwxyz' + 'ABCDEFGHIJKLMNOPQRSTUVWSYZ' + '0123456789'
codeCount = len(codes)
passwords = []
num = 0
while num< M:
pas = random.sample(codes ,N)
num += 1
st = ','.join(pas)
print(st.replace(',', ''))