test.py 686 B

123456789101112131415161718192021222324
  1. # https://www.now.cn/user/to_register.php?&ajax_code=1&types=mobile&mobile=13119458542
  2. import random
  3. def create_phone():
  4. # 第二位数字
  5. second = [3, 4, 5, 7, 8][random.randint(0, 4)]
  6. # 第三位数字
  7. third = {
  8. 3: random.randint(0, 9),
  9. 4: [5, 7, 9][random.randint(0, 2)],
  10. 5: [i for i in range(10) if i != 4][random.randint(0, 8)],
  11. 7: [i for i in range(10) if i not in [4, 9]][random.randint(0, 7)],
  12. 8: random.randint(0, 9),
  13. }[second]
  14. # 最后八位数字
  15. suffix = random.randint(9999999,100000000)
  16. # 拼接手机号
  17. return "1{}{}{}".format(second, third, suffix)
  18. print(create_phone())
  19. # 生成手机号