import phonenumbers
ph_no = "918332 88 1992"
print(phonenumbers.parse(ph_no, "IN"))
输出:
Country Code: 91 National Number: 8332881992
所需的输出:
8332881992
我只需要电话号码即可返回。请帮助!
您需要解析的电话号码的national_number
属性。 Docs can be found here。
import phonenumbers
ph_no = "918332 88 1992"
p = phonenumbers.parse(ph_no, "IN")
print(p.national_number)
您可以访问已解析的电话号码的.national_number
attribute [GitHub]: