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
    
    
    
    

  • 相关阅读:
    Java 抽象类
    Java final 关键字
    Java 异常机制
    hashcode和equals
    DevExpress 柱状图
    Windows X64平台搭建Java开发环境
    J2EE 学习路线
    winform 客户端采用HTTP协议与服务端通信
    C# 处理Json
    性能分析工具 DotTrance
  • 原文地址:https://www.cnblogs.com/TendToBigData/p/10501257.html
Copyright © 2011-2022 走看看