Home > Blockchain >  PYTHON PRINT RANDOM PHONE NUMBERS
PYTHON PRINT RANDOM PHONE NUMBERS

Time:05-31

Sup folks!

I'm trying to print a huge list, of what should be phone numbers. Considering the phone number where a live is as it follows (24)999999999. I don't need the parenthesis, I just need to print then randomly.
the first two digits has to be between 11 and 24 the following two, which will be the the third and the fourth digits must be between 67 and 99

Now it's better if you take a look at what I've done so far

ddd = list(range(11, 24))                                                                                                                                                                     
op = list(range(67, 99))                                                                                                                                                                      
list1 = list(range(100, 999))                                                                                                                                                                 
list2 = list(range(1234, 9999))                                                                                                                                                               
for d in ddd:                                                                                                                                                                                 
    ddd = d                                                                                                                                                                                   
    #print(ddd)                                                                                                                                                                               
    for fixos in op:                           
        pre = fixos                            
        #print(pre)                            
        for l in list1:                       
            part1 = l                                                                         
            #print(part1)                                                                     
            for x in list2:   
                part2 = x                                                                    
                #print(part2)                                                                 
                #print(f"({ddd}) {pre}{l}-{l2}")                                              
                numbers = str(ddd)   str(pre)   str(l)   str(x)                              
                #print(numbers)                                                               
                requests.urllib3.disable_warnings()

The list1 and list2 are gonna compose the rest of the number. As I said, I would like to do it as randomly as possible.

However when I run the script it prints like this

numbers : 11671001000                                                                                                                                                      
numbers : 11671001001

It goes one by one. T_T Sadly that's not what I intended to do.

Would anyone be able to help me out on this one?

CodePudding user response:

you can try this code it make 100,000 number also you can edit range 100,000 to your goal number

import random
ddd = list(range(11, 25))
op = list(range(67, 100))
for i in ddd:
    for j in op:
        beg=(str(i) str(j))
        for p in range(100000):
            random_number=random.randint(1000000, 10000000)
            print(beg str(random_number))
  • Related