py 随机生成一个电话号码
作者:互联网
# -*- coding: utf-8 -*-
import random
def createPhone():
prelist=["130", "131", "132", "133", "134", "135", "136", "137", "138", "139",
"147", "150", "151", "152", "153", "155", "156", "157", "158", "159",
"186", "187", "188", "189"]
new_phone = random.choice(prelist) + "".join(random.choice("0123456789")for i in range(8))
return new_phone
if __name__ == '__main__':
phone = createPhone()
print(phone)
标签:__,py,createPhone,random,choice,prelist,phone,随机,电话号码 来源: https://blog.csdn.net/qq_15603633/article/details/119449207