[Python]迭代(Iteration)

如果给定一个list或tuple,我们可以通过for循环来遍历这个list或tuple,这种遍历我们称为迭代;

在Python中,迭代是通过for ... in来完成的,而很多语言比如C语言,迭代list是通过下标完成的,比如C代码:

for (i=0; i<length; i++) {
    n = list[i];
}
原文地址:https://www.cnblogs.com/LeeCookies/p/15434534.html