python篇历字典中的值
>>> dict1 = {'name': 'earth', 'port': 80} >>> for key in dict1: ... print 'key=%s,value=%s' % (key,dict1[key])... key=name,value=earthkey=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>>>
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。