1 #encoding:utf-8 2 #Python 3.4.3 3 import urllib 4 import requests 5 phone=input(‘输入一个手机号码:‘) 6 url=‘https://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=%s‘ % phone 7 data=urllib.request.urlopen(url).read().decode(‘gbk‘) 8 dict=eval(data.replace(‘__GetZoneResult_ =‘,‘‘).replace(‘\r\n‘,‘‘).replace(‘ ‘,"‘").replace(‘\t‘,"‘").replace(‘:‘,"‘:")) 9 print(‘省份: ‘,dict.get(‘province‘)) 10 print(‘运营商: ‘,dict.get(‘catName‘)) 11 print(‘号码: ‘,dict.get(‘telString‘))
时间: 2024-11-08 05:12:01