• 快递查询


    #encoding:UTF-8
    #Python 3.4.3
    import urllib
    import requests 
    '''
    天天快递    运单号码: 667612364334  
    圆通速递    运单号码: 885300598318625893 
    韵达快递    运单号码: 3839920843883
    '''
    kd=[['申通','shentong',0],
    ['EMS' ,'ems',1],
    ['顺丰','shunfeng',2],
    ['圆通','yuantong',3],
    ['中通','zhongtong',4], 
    ['韵达','yunda',5],
    ['天天','tiantian',6],
    ['汇通','huitongkuaidi',7], 
    ['全峰','quanfengkuaidi',8], 
    ['德邦','debangwuliu',9],
    ['宅急送','zhaijisong',10]]
      
    for i in range(len(kd)):
        print('快递公司: ',kd[i][0],'编号: ',kd[i][2])
    type,postid=input('请输入快递编号和快递单号(逗号分隔): ').split(',')
    company1=''
    company2=''
    s=int(''+type)
    for i in range(len(kd)):
        if kd[i][2]==s:
            company1=kd[i][0]
            company2=kd[i][1]
    url='http://www.kuaidi100.com/query?type=%s&postid=%s' %(company2,postid)
    data=urllib.request.urlopen(url).read().decode('utf-8')
    dict=eval(data)
    print('                                                  ')
    print('**************************************************')
    print('快递单号: ',dict.get('nu'))
    print('快递公司: ',company1)
    l=dict.get('data')
    for i in range(len(l)):
        print ('派件情况:',l[i].get('time'),l[i].get('context'))
        
    
    
        
        
        
        
        
        
        
        
        
        
        
  • 相关阅读:
    C#题型补充
    php数组
    PHP字符串
    动态网页制作PHP常用的正则表达式
    Objective-C:Foundation框架-常用类-NSArray
    Objective-C:Foundation框架-常用类-NSMutableString
    Objective-C:Foundation框架-常用类-NSString全解
    Objective-C:Block
    Objective-C:Category
    Objective-C:@property参数详解
  • 原文地址:https://www.cnblogs.com/stay-hungry/p/6950655.html
Copyright © 2020-2023  润新知