代码拉取完成,页面将自动刷新
import random
def generate_mobile_numbers(count):
prefixes = {
"中国电信": ["133", "153", "180", "181", "189", "177", "173", "149", "199"],
"中国联通": ["130", "131", "132", "155", "156", "185", "186", "145", "175", "176", "166"],
"中国移动": ["134", "135", "136", "137", "138", "139", "147", "150", "151", "152", "157", "158", "159", "172", "178", "182", "183", "184", "187", "188", "198"],
}
mobile_numbers = set()
while len(mobile_numbers) < count:
operator = random.choice(list(prefixes.keys()))
prefix = random.choice(prefixes[operator])
suffix = "".join(random.choice("0123456789") for _ in range(8))
mobile_number = prefix + suffix
mobile_numbers.add((operator, mobile_number))
return mobile_numbers
# 生成1000个不重复手机号码示例并保存到文件
mobile_numbers = generate_mobile_numbers(5000000)
with open("mobile_numbers.txt", "w") as file:
for operator, mobile_number in mobile_numbers:
# file.write(f"运营商:{operator}\n")
file.write(f"{mobile_number}\n")
# file.write("---\n")
print("手机号码已保存到mobile_numbers.txt文件中。")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。