源码之家

  • 首页
  • 文章
  • 问答
  • 下载
您的位置: 首页  >  文章  >  python篇历字典中的值

python篇历字典中的值

分类: 文章 • 2022-07-10 13:34:23
>>> dict1 = {'name': 'earth', 'port': 80}         
>>> for key in dict1:                             
...     print 'key=%s,value=%s' % (key,dict1[key])
... 
key=name,value=earth
key=port,value=80

>>> dict1['name']
'earth'
>>> print 'host %s is running on port %d' % (dict1['name'],dict1['port'])
host earth is running on port 80
>>> 

相关推荐

  • Python中字典的近亲——集合
  • 三篇文章,理解python类中的方法所需要的参数 self
  • Python中时间的处理之——timedelta篇
  • python习题第六章最后一个 字典中嵌套字典的数据访问方式
  • 迷人的学霸操作!教你Python中合并字典的多种解题方法!
  • python从入门到放弃篇7数据结构之顺序表(顺序表的排序,删除操作,表中最大值,最小值的查询)
  • Python中如何查看Pandas DataFrame对象列的最大值、最小值、平均值、标准差、中位数等
  • 一篇博客分清shell中的状态返回值-return-break-continue-exit
  • 一篇博客分清shell中的状态返回值-return-break-continue-exit
  • Python递归求出列表(包括列表中的子列表)的最大值
  • 在Angular2中不能可靠地触发路径参数订阅
  • oracle 函数之分析函数
    网站免责声明 网站地图 最新文章 用户隐私 版权申明
本站所有数据收集于网络,如果侵犯到您的权益,请联系网站进行下架处理。   

Copyright © 2018-2021   Powered By 源码之家    备案号:   粤ICP备20058927号