我在找一个电话号码的载体
我在python中使用phonenumbers,并不断出现此错误
‘str’ object has no attribute ‘country_code’
这是我的密码:
import phonenumbers
num = input("phone number")
from phonenumbers import carrier
Carrier = carrier.name_for_number("+1" + num, "en")
print(Carrier)
![enter image description here](https://i.stack.imgur.com/BcsQm.png)![enter image description here](https://i.stack.imgur.com/x6TSc.png)![enter image description here](https://i.stack.imgur.com/EONAZ.png)![enter image description here](https://i.stack.imgur.com/X3iVY.png)![enter image description here](https://i.stack.imgur.com/Xpbec.png)
似乎name_for_number需要一个对象,因此您必须首先解析输入:
我建议你这样做:
相关问题 更多 >
编程相关推荐