在我们的实际测试的过程中,我们会遇到手机号注册等,其实这是让我们很头疼呢,下面来分享一则python实现随机生成手机号的代码。
import random
def suiji():
list=['134','(移动:)135','(移动)136','(移动)137','(移动)138','(移动)139','(移动)150','(移动)151','(移动)152','(移动)157','(移动)158','(移动)159','(移动)187','(TD专用)188','(联通)130','(联通)131','(联通)132','(联通)155','(联通)156','(联通)185','(联通)186','(电信)133','(电信)153','(电信)180','(电信)189']
shou=random.choice(list)
haoma="0123456789"
haom=''
haom1=[]
for i in range (8):
haom1.append(random.choice(haoma))
haom = ''.join(haom1)
print(shou haom)
suiji()