Python中记录循环次数的方法


当前第2页 返回上一页

想到的替代方案是:

1

2

3

4

5

count=0for item in list:

    print item

    count +=1

    if count % 10 == 0:

        print 'did ten'

或:

1

2

3

4

for count in range(0,len(list)):

    print list[count]

    if count % 10 == 0:

        print 'did ten'

以上就是Python中记录循环次数的方法的详细内容,更多文章请关注木庄网络博客!!

返回前面的内容

相关阅读 >>

Python多线程中阻塞(join)与锁(lock)使用误区解析

函数基础知识(Python

Python input()函数怎么用

Python如何做一个登录注册界面

Python和access的区别

Python序列循环移位的3种方法

Python图像处理的基础和opencv的入门函数

Python如何创建指定范围的数字列表?(代码示例)

Python有map吗

Python安装matplotlib失败怎么解决

更多相关阅读请进入《Python》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...