import phonenumbers
ph_no = "918332 88 1992"
print(phonenumbers.parse(ph_no, "IN"))
输出:
Country Code: 91 National Number: 8332881992
期望输出:
8332881992
我只需要电话号码返回。请帮忙!
您需要已分析电话号码的national_number
属性。文档可以在这里找到。
import phonenumbers
ph_no = "918332 88 1992"
p = phonenumbers.parse(ph_no, "IN")
print(p.national_number)
您可以访问解析的电话号码的.national_number
属性 [GitHub]:
import phonenumbers
ph_no = "918332 88 1992"
print(phonenumbers.parse(ph_no, "IN").national_number)