本文原创,版权属作者个人所有,如需转载请联系作者本人。Q&微:155122733
--------------------------------------------------------------------------------------------------------
enumberate()
#!/usr/bin/python values={'name':'cola','age':18} for i,chr in enumerate(values): print(i,chr) ''' display: 0 age 1 name ''' chars=['a','b','c'] for i,char in enumerate(chars): print(i,char) ''' display: 0 a 1 b 2 c ''' truples=('a','b','c') for i,char in enumerate(chars): print(i,char) ''' display: 0 a 1 b 2 c '''