##onefor letter in 'Python': print 'Current Letter : ',letter##twofruits = ['banana','apple','mange']for i in range(len(fruits)): print i ,fruits[i]
l = [1,2,3,'a','c']s = (1,2,3,'b','c')d = {1:'a',2:'b',3:'c'} ##字典for x in l: print xfor a in range(len(s)): print s[a]for dic in d : print dic print d[dic] ##用for 遍历字典时只能得出key值。for k,v in d.items(): ##用items 就可以把字典中的key值和value值给遍历出来。 print k print v