Examples are as follows:
Def TestDic1 ():
dict2 ={' AA ': 222,11:222} for
val in Dict2:
print val
def TestDic2 ():
dict2 ={' AA ' : 222,11:222} for
(Key,val) in Dict2.items ():
print Key, ":", Val
def TestList1 ():
list=[ 1,2,3,4,5,3,2, ' Ada ', ' FS3 '] for
i in range (len (list)):
print list[i]
def TestDic3 ():
dict2 ={' AA ' : 222,11:222}
print "########## #iteritems #################" for
k,v in Dict2.iteritems ():
print "dict [%s]=% k,v
def TestDic4 ():
dict2 ={' AA ': 222,11:222}
print "########## #iterkeys, itervalues#######"
for k,v in Zip (Dict2.iterkeys (), Dict2.itervalues ()):
print "dict[%s]="% k,v
def TestList2 ():
list=[1,2,3,4,5,3,2, ' Ada ', ' FS3 '] for
i in list:
print I
Above this python traversal truple list Dictionary Several methods summary is small series to share to everybody's content, hoped can give everybody a reference, also hoped that everybody supports the cloud habitat community.