dict={"name":"python","english":33,"math":35}#1. for in for i in dict: print "dict[%s]=" % i,dict[i]#2. itemsfor (k,v) in dict.items(): print "dict[%s]=" % k,v#3. iteritems"for k,v in dict.iteritems(): print "dict[%s]=" % k,v
本文共 285 字,大约阅读时间需要 1 分钟。
dict={"name":"python","english":33,"math":35}#1. for in for i in dict: print "dict[%s]=" % i,dict[i]#2. itemsfor (k,v) in dict.items(): print "dict[%s]=" % k,v#3. iteritems"for k,v in dict.iteritems(): print "dict[%s]=" % k,v
转载于:https://my.oschina.net/wdyoschina/blog/701883