import random
def generate_phone_number(operator_codes, total_numbers):
with open('num.txt', 'w') as file:
for _ in range(total_numbers):
code = random.choice(operator_codes)
number = '+7' + str(code) + ''.join(random.choice('0123456789') for _ in range(7))
file.write(number + '\n')
return 'Номера сгенерированы!.'
operator_codes = [
# МТС
910, 915, 916, 917, 918, 919,
# МегаФон
920, 921, 922, 923, 924, 925, 926, 927, 928, 929,
# Билайн
902, 903, 904, 905, 906, 909, 951, 953, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969,
# Теле2
900, 901, 904, 908, 950, 951, 952, 953, 954,
# Йота
999
]
number_to_generate = 10000 # поменяй число на нужное
generate_phone_number(operator_codes, number_to_generate)