aa = ("ssssss","gggggg","kkkkkk",) bb = ["sdg","sdgdg","wefef",2334,4567,] cc = {"k1":"v1","k2":"v2",} dd = "liuzm" for a in enumerate(aa): print(a) for b in enumerate(bb): print(b) for c in enumerate(cc): print(c) for d in enumerate(dd): print(d)
执行结果:
(0, 'ssssss')
(1, 'gggggg')
(2, 'kkkkkk')
(0, 'sdg')
(1, 'sdgdg')
(2, 'wefef')
(3, 2334)
(4, 4567)
(0, 'k2')
(1, 'k1')
(0, 'l')
(1, 'i')
(2, 'u')
(3, 'z')
(4, 'm')