其他分享
首页 > 其他分享> > 自动化测试常用脚本-随机生成手机号码

自动化测试常用脚本-随机生成手机号码

作者:互联网

# coding:UTF-8

# 随机生成手机号码
import random
from string import digits


def createPhoneNumber():
    prelist = ["130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "147", "150",
               "151", "152", "153", "155", "156", "157", "158", "159", "186", "187", "188"]
    # return random.choice(prelist) + "".join(random.choice("0123456789") for i in range(8))
    return random.choice(prelist) + ''.join(random.sample(digits, 8))


if __name__ == '__main__':
    print(createPhoneNumber())

 

标签:__,return,import,random,choice,prelist,随机,自动化,手机号码
来源: https://www.cnblogs.com/chenri/p/11365742.html