This article example describes the Python implementation of the random creation of telephone numbers. Shared for your reference, as follows:
When you need to generate some random phone numbers, you can use the following script, simple and practical, the first list of
list
The numbers in the list can be added by yourself, and you can generate as many as you want just by modifying therange(100)
# -*- coding:utf-8 -*- import random def Create_num(): list = ['139','138','137','136','135','134','159','158','157','150','151','152','188','187','182','183','184','178','130','131','132','156','155','186','185','176','133','153','189','180','181','177'] str = '0123456789' for i in range(100): print((list) + "".join((str) for i in range(8))) Create_num()
(Note: The list of phone numbers in the original code is slightly improved and modified to include all number segments as much as possible!)
Test run results:
PS: Here is another related tool for your reference:
Online randomized personal information data generation tool:
http://tools./aideddesign/rnd_userinfo
More about Python related content can be viewed on this site's topic: theSummary of Python Math Operations Tips》、《Summary of Python string manipulation techniques》、《Summary of Python coding manipulation techniques》、《Python Data Structures and Algorithms Tutorial》、《Summary of Python function usage tips》、《Python introductory and advanced classic tutorialsand thePython Regular Expression Usage Summary》
I hope that what I have said in this article will help you in Python programming.