摘要:
http://eagletff.blog.163.com/blog/static/116350928201266111125832/一般情况下,如果要对一个列表或者数组既要遍历索引又要遍历元素时,可以用enumerate比如:for index,value in enumerate(list):print index,value当然也可以for i in range(0,len(list)):print i,list[i]相比较而言,前者更简练另外一种使用情况,当要计算文件的行数的时候,可以这样写:lineNum = len(open(fileName,'r').readlin
阅读全文