如何用python实现生成500w随机电话号码的方式,excel模块会有这个限制,ValueError: row index was 65536, not allowed by .xls format
1条回答 默认 最新
- Web Security Loop 2023-03-01 15:51关注
import random def generate_phone_number(): """生成一个随机电话号码""" prefix = ["130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "150", "151", "152", "153", "155", "156", "157", "158", "159", "180", "181", "182", "183", "184", "185", "186", "187", "188", "189"] return random.choice(prefix) + "".join(random.choice("0123456789") for _ in range(8)) if __name__ == "__main__": phone_numbers = [generate_phone_number() for _ in range(5000000)] with open("phone_numbers.txt", "w") as f: f.write("\n".join(phone_numbers))
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 2无用
悬赏问题
- ¥15 Python语言实验
- ¥15 SAP HANA SQL 增加合计行
- ¥20 用C#语言解决一个英文打字练习器,有偿
- ¥15 srs-sip外部服务 webrtc支持H265格式
- ¥15 在使用abaqus软件中,继承到assembly里的surfaces怎么使用python批量调动
- ¥15 大一C语言期末考试,求帮助🙏🙏
- ¥15 ch340驱动未分配COM
- ¥15 Converting circular structure to JSON
- ¥30 Hyper-v虚拟机相关问题,求解答。
- ¥15 TSM320F2808PZA芯片 Bootloader