python-phonenumbers icon indicating copy to clipboard operation
python-phonenumbers copied to clipboard

What does phonenumbers.number_type() return?

Open HarryNeustein opened this issue 13 years ago • 2 comments

I searched quite long but what does 0 and 1 as return of the method number_type() mean?

Is 0 for landline and 1 for mobile?

I cannot find any documentation about the return value. Can anyone help me please?

HarryNeustein avatar May 13 '13 22:05 HarryNeustein

It returns a PhoneNumberType enum, so 0 is FIXED_LINE and 1 is MOBILE.

>>> import phonenumbers
>>> help(phonenumbers.number_type)
number_type(numobj)
    Gets the type of a phone number.

    Arguments:
    numobj -- The PhoneNumber object that we want to know the type of.

    Returns the type of the phone number, as a PhoneNumberType value.
>>> help(phonenumbers.PhoneNumberType)
class PhoneNumberType(__builtin__.object)
 |  Type of phone numbers.
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  FIXED_LINE = 0
 |  
 |  FIXED_LINE_OR_MOBILE = 2
 |  
 |  MOBILE = 1
...

I've clarified the docstring a bit.

daviddrysdale avatar May 14 '13 05:05 daviddrysdale

Great. Thank you!

HarryNeustein avatar May 17 '13 14:05 HarryNeustein