Python中得到的手机/电话号码,MNC和国家代码
问题描述:
我怎么会得到来自国际手机/电话号码Python中得到的手机/电话号码,MNC和国家代码
我一直库下面使用分离MNC和国家代码:
//我需要这样的东西
number = validate("+919746XXXX")
number.mnc()
9746
number.country_code()
91
答
要使用phonenumbers库
>>> import phonenumbers
>>> x = phonenumbers.parse("+442083661177", None)
>>> x.country_code
44
而对于移动网络代码,电话号码可以在不同的运营商之间的移动得到一个电话号码的国家代码,所以你不能被检测MNC电话号码。
国家代码在那里。但MNC? –