我如何从国际手机/电话号码中分离出 MNC 和国家/地区代码
我使用了以下库:
//我需要类似的东西
number = validate("+919746XXXX")
number.mnc()
9746
number.country_code()
91
最佳答案
使用 phonenumbers 获取电话号码的国家代码库,尝试:
>>> import phonenumbers
>>> x = phonenumbers.parse("+442083661177", None)
>>> x.country_code
44
对于移动网络代码,电话号码可以在不同的运营商之间移动,因此仅通过电话号码无法检测到mnc。
关于Python获取手机/电话号码的mnc和国家代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32800218/