邮箱大全含各类型邮箱

时间:2024-03-01 10:07:05
[点击前往新博客网站](http://sensewang.cn) 

1
# 创建的账户并非真实账户,纯属娱乐 2

3 import random 4 5 import os 6 7 path = r"C:\Users\Administrator\Desktop\mail.txt" 8 9 10 def mail(): 11 12 if os.path.isfile(path): 13 14 f = open(path, "w") 15 16 num = 0 17 18 times = int(input("需要多少个邮箱账户?")) 19 20 while num < times: 21 22 random_num = random.randint(100000000, 99999999999) 23 24 # 1)、随机用户名,格式为"姓名缩写+手机号" 25 # name_list是包含26个英语字母的列表 26 name_list = [chr(x) for x in range(ord("a"), ord("z") + 1)] 27 28 random.shuffle(name_list) 29 30 name = name_list[0] + name_list[1] + name_list[2] 31 32 random_num1 = random.randint(100000, 999999) 33 34 username = name + str(random_num1) 35 36 # 2)、随机邮箱 37 mail_name_list = [163, "qq", "gmail", 126] 38 39 random_num2 = random.randint(0, 3) 40 41 mail_name = mail_name_list[random_num2] 42 43 # 因为qq邮箱都是qq号码,所以需要判断一下 44 if mail_name == "qq": 45 46 username = random_num 47 48 # 3)、随机密码 49 50 # 包含小写字母 51 small_list = [chr(b) for b in range(ord("A"), ord("Z") + 1)] 52 53 # 包含数字 54 num_list = [chr(a) for a in range(ord("0"), ord("9") + 1)] 55 56 str1 = "".join(name_list + num_list + small_list) 57 58 password = random.sample(str1, 10) 59 60 # random中的sample函数会随机拿出10个字符组成列表,因此需要再次用到join函数 61 passwd = "".join(password) 62 63 f.write("%s@%s.com----%s\n" % (username, mail_name, passwd)) 64 65 num += 1 66 67 # 如果没有此文件,就会创建此文件 68 else: 69 70 file1 = open(path, "w") 71 72 file1.close() 73 74 mail() 75 76 77 mail()