python篇历字典中的值-成都快上网建站

python篇历字典中的值

>>> 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篇历字典中的值
浏览地址:http://kswjz.com/article/iecdoh.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流