Skip to content

Python code snippet – How to count in a loop ?

count=0
for item in list:
    print item
    count +=1
    if count % 10 == 0:
        print 'did ten'
See also  How to remove microseconds from datetime in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.