Reputation: 29
import phonenumbers
ph_no = "918332 88 1992"
print(phonenumbers.parse(ph_no, "IN"))
Output:
Country Code: 91 National Number: 8332881992
Desired Output:
8332881992
I just need the phonenumber to return. Please help!
Upvotes: 1
Views: 337
Reputation: 476503
You can access the .national_number
attribute [GitHub] of the parsed phone number:
import phonenumbers
ph_no = "918332 88 1992"
print(phonenumbers.parse(ph_no, "IN").national_number)
Upvotes: 0
Reputation: 14486
You need the national_number
attribute of the parsed phone number. Docs can be found here.
import phonenumbers
ph_no = "918332 88 1992"
p = phonenumbers.parse(ph_no, "IN")
print(p.national_number)
Upvotes: 1