Advertisement

Python中字典的定义及简单示例

阅读量:
复制代码
 #coding=utf8

    
 print '''
    
 Python中的字典映射数据类型是由键值对构成。
    
 python中字典一般以数字或者字符串作为键。
    
 Python中字典的值可以是任意类型的Python对象,字典元素用大括号{}包裹。
    
 '''
    
 dicDefine={
    
     'Name':'ewang',
    
     'Age': 28,
    
     'Sex': 'famale',
    
     'BirthDay':'1998/09/1'
    
     }
    
  
    
 print 'The content of dicDefind',dicDefine
    
 print 'The keys of  dicDefind',dicDefine.keys( )
    
 print 'The values of dicDefind',dicDefine.values()
    
 print 'The items of dicDefind',dicDefine.items()
    
    
    
    

全部评论 (0)

还没有任何评论哟~