In Python you have two fine ways to repeat some action more than once. One of them is while loop and the other - for loop. So let\'s have a look on
while
for
This is lighter weight than xrange (and the while loop) since it doesn't even need to create the int objects. It also works equally well in Python2 and Python3
xrange
int
from itertools import repeat for i in repeat(None, 10): do_sth()