zoukankan      html  css  js  c++  java
  • Python Data Structures (数据结构)

    #Python Data Structures
    #working with lists
    words = "the quick brown for jumps over the lazy dog".split()
    print(words)
    info = [[w.upper(),w.lower(),len(w)] for w in words]
    for data in  info:
        print (data)
    
    
    #Dictionaries
    students = {'name':'Alex' ,'age' : 16 ,'grade':'sixth'}
    print('name ',students['name'])
    
    # Organizing Data using Diectionaries
    
    d = {'three' : 3 , 'one':1,'two':2}
    x = dict(six =6 ,four =4 ,five =5)
    t = dict(one =1 ,tow =2 ,three = 3,**x)
    print t
    
    print 'three' in t
    
    print 'r' in t
    for k in t : print  k  # print the key
    for k,v in t.items() : print (k,v )
    
    
    print t.get('five1','data not found')
    
    print x.pop('five')
    print x
    
    # updating Dictionary Elements
    
    student = {'name':'lisi'}
    print  student['name']
    student['name']='zsan'
    
    print  student['name']
    
    #Deleting Dictionary elements
    student = {'name':'lisi','comments':'some comments for tesint del'}
    
    del student['comments']
    print  student['comments']
    
    student.clear()
    del student
    
    
    
    

  • 相关阅读:
    RABC权限管理
    七牛云上传
    支付宝沙箱支付(Django端)超适合小白哦~
    ModelSerialzier + ModelViewSet基础使用
    微博三方登录
    Celery梳理
    ios 动画
    ios 贝塞尔动画
    ios 贝塞尔
    ios Masonry 开发细节
  • 原文地址:https://www.cnblogs.com/TendToBigData/p/10501257.html
Copyright © 2011-2022 走看看