python随机生成邮箱
转载
# -*- coding:utf-8 -*-
import random
def RandomEmail( emailType=None, rang=None):
__emailtype = ["@qq.com", "@163.com", "@126.com", "@189.com"]
# 如果没有指定邮箱类型,默认在 __emailtype中随机一个
if emailType == None:
__randomEmail = random.choice(__emailtype)
else:
__randomEmail = emailType
# 如果没有指定邮箱长度,默认在4-10之间随机
if rang == None:
__rang = random.randint(4, 10)
else:
__rang = int(rang)
__Number = "0123456789qbcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPWRSTUVWXYZ"
__randomNumber = "".join(random.choice(__Number) for i in range(__rang))
_email = __randomNumber + __randomEmail
return _email
print(RandomEmail())
print(RandomEmail(emailType='@qq.com',rang=20))
# -*- coding:utf-8 -*-
import random
def RandomEmail( emailType=None, rang=None):
__emailtype = ["@qq.com", "@163.com", "@126.com", "@189.com"]
# 如果没有指定邮箱类型,默认在 __emailtype中随机一个
if emailType == None:
__randomEmail = random.choice(__emailtype)
else:
__randomEmail = emailType
# 如果没有指定邮箱长度,默认在4-10之间随机
if rang == None:
__rang = random.randint(4, 10)
else:
__rang = int(rang)
__Number = "0123456789qbcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPWRSTUVWXYZ"
__randomNumber = "".join(random.choice(__Number) for i in range(__rang))
_email = __randomNumber + __randomEmail
return _email
print(RandomEmail())
print(RandomEmail(emailType='@qq.com',rang=20))