import random import string # 随机生成6到20位包含大小写字母加数字的用户名 def Creat_usernamePwd(): i = random.randint(6,20) username = ''.join(random.sample(string.ascii_letters + string.digits, i)) return username