Phonenumbers
Description:
- Work with phonenumbers
Resources:
Example 1
Section titled “Example 1”Parse, format and validate a phone number.
The first number uses the fictional area code 555, so it has a possible length but is not a valid number (expect possible: True and valid: False). The library’s own example number for the US is valid.
import phonenumbers
phone_number = "+15557543453"
x = phonenumbers.parse(phone_number, None)print(phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.E164))print("possible:", phonenumbers.is_possible_number(x))print("valid:", phonenumbers.is_valid_number(x))
example = phonenumbers.example_number("US")print(phonenumbers.format_number(example, phonenumbers.PhoneNumberFormat.INTERNATIONAL))print("valid:", phonenumbers.is_valid_number(example))ganymede is made by Eugo