欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

随机生成不重复的手机号

程序员文章站 2024-01-14 21:12:22
...
import random

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


raddomPhone()