Answer the question
In order to leave comments, you need to log in
phonenumbers module. How can I remove this text and not get an error?
Working with the phonenumbers module
Here is a piece of code:
try:
number_parse = phonenumbers.parse("+375298571212")
number_code = (region_code_for_country_code(number_parse.country_code))
number_city = (geocoder.description_for_number(number_parse, "en"))
number_operator = (carrier.name_for_number(number_parse, "en"))
number_timezone = (timezone.time_zones_for_number(number_parse))
bot.send_message(message.chat.id, f'<b>Номер:</b> <code>{number_parse}</code>\n\n<b>Страна:</b> {number_city}\n<b>Код:</b> {number_code}\n<b>Оператор:</b> {number_operator}\n<b>Часовой пояс:</b> {number_timezone}', parse_mode="html", reply_markup=menu)
except Exception as e:
bot.send_message(message.chat.id, f'❌ <b>Произошла ошибка: {e}</b>\n<em>Вы перемещены в меню.</em>', parse_mode="html", reply_markup=menu)
Номер: Country Code: 375 National Number: 298571212
Страна: Belarus
Код: BY
Оператор: MTS
Часовой пояс: ('Europe/Moscow',)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question