Implementation results:
Source:
Importurllib.requestImportJSONImportmsvcrtkd_dict= {1:'Shentong', 2:'Youzhengguonei', 3:'Yuantong', 4:'Shunfeng', 5:'Yunda', 6:'Zhongtong', 7:"Tiantian", 8:"Debang"}defCheck (): whileTrue:Print("only the following courier company inquiries are supported:") Print("1. Shentong") Print("2.EMS Post") Print("3. Tact") Print("4. Downwind") Print("5. Yun da") Print("6. Zhong Tong") Print("7. Every day") Print("8. German-State") Print("0. exit \ n") Choose= Int (Input ("Please select your courier company:")) whileChoose not inchRange (0,6): Choose= Int (Input ("sorry for not supporting this company please re-select:")) ifChoose = =0:Print("thanks for using!\n") BreakKd_num= Input ("Please enter the Courier number:") URL="http://www.kuaidi100.com/query?type=%s&postid=%s"%(Kd_dict[choose], kd_num) Response=urllib.request.urlopen (URL) HTML= Response.read (). Decode ('Utf-8') Target=json.loads (HTML)#print (target)Status = target['Status'] ifStatus = =' $': Data= target['Data'] #print (data)Data_len =len (data)#print (Data_len) #print ("\ n") forIinchRange (Data_len):Print("\ n Time:"+ data[i][' Time']) Print("Status:"+ data[i]['Context'] +"") Print("\ n Thank you for using!\n") Break Else: Print("input Error Please re-enter!\n") #Print ("Press any key to end ...")if __name__=='__main__': whileTrue:check () out= Input ("Press any number to exit (other keys continue) ...") ifOut >='0' andOut <='9': Break Else: Print("\ n") Continue
-----------------------
Bored............
Python Implementation Express Query