Run
import phonenumbers # Phone number in a string phonenumber_string = "+442083661177" # Parse string to a PhoneNumber object x = phonenumbers.parse(phonenumber_string) # Format PhoneNumber to NATIONAL formatted = phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.NATIONAL) print('NATIONAL : ', formatted) # Format PhoneNumber to INTERNATIONAL formatted = phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.INTERNATIONAL) print('INTERNATIONAL : ', formatted) # Format PhoneNumber to E164 formatted = phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.E164) print('E164 : ', formatted)
Output