python list 遍历使用enumerate,包含数字和ele

一直以来,使用python list 从来没有好好的使用enumerate这个函数,发现非常有用,再也不用 for i in range(len(li)):太蹩脚
1 def print_everything(*args):
2     for count, thing in enumerate(args):
3         print {0}. {1}.format(count, thing) 
原文地址:https://www.cnblogs.com/harveyaot/p/3126747.html