Python_查询手机供应商

 1 def Seach_Phone_Nmuber_operator():
 2     CN_mobile = [134,135,136,137,138,139,150,151,152,157,158,159,182,183,184,187,188,147,178,1705]
 3     CN_union = [130,131,132,155,156,185,186,145,176,1709]
 4     CN_telecom = [133,153,180,181,189,177,1700]
 5 
 6     phone_nmu = input('请输入要查询的手机号:')
 7     qc_rd = phone_nmu[0:3]
 8     if len(phone_nmu) == 11:
 9         if phone_nmu.isdigit():
10             if int(qc_rd) in CN_mobile:
11                 print("您输入的手机号是:",phone_nmu)
12                 print("供应商:中国移动 \n")
13             elif int(qc_rd) in CN_union:
14                 print("您输入的手机号是:", phone_nmu)
15                 print("供应商:中国联通 \n" )
16             elif int(qc_rd) in CN_telecom:
17                 print("您输入的手机号是:", phone_nmu)
18                 print("供应商:中国电信\n")
19             else:
20                 print("您输入的手机号号段不正确,请重新输入 \n")
21         else:
22             print("无效的手机号,输入的手机号必须是11位数字 \n")
23     else:
24         print("无效的手机号,请输入11位数字的手机号 \n")
25     i = 1
26     while i > 0:
27         Seach_Phone_Nmuber_operator()
28 Seach_Phone_Nmuber_operator()

 

posted @ 2016-12-29 15:25  Daniel_yan_0728  阅读(181)  评论(0编辑  收藏  举报