A slightly faster approach than looping on xrange(N)
is:
import itertools
for _ in itertools.repeat(None, N):
do_something()
More Related Contents:
- What am i doing wrong in this python script?
- How to do for loop through all items of a list except the first [duplicate]
- Why does python use ‘else’ after for and while loops?
- Append existing excel sheet with new dataframe using python pandas
- Styling multi-line conditions in ‘if’ statements? [closed]
- How to change index of a for loop?
- Forced naming of parameters in Python
- Python import coding style
- How do I loop through a list by twos? [duplicate]
- Changing variable names with Python for loops [duplicate]
- Why do I get an IndexError (or TypeError) from “ar[i]” inside “for i in ar”?
- Printing a list separated with commas, without a trailing comma
- For loop with custom steps in python
- Should ‘if’ statement always have an ‘else’ clause? [closed]
- Are infinite for loops possible in Python? [duplicate]
- Why does this python dictionary get created out of order using setdefault()?
- In Python, when should I use a function instead of a method?
- Is it possible to make a `for` loop without an iterator variable? (How can I make make code loop a set number of times?)
- Reverse a string without using reversed() or [::-1]?
- How to get the previous element when using a for loop? [duplicate]
- Converting List Comprehensions to For Loops in Python
- How to change all the dictionary keys in a for loop with d.items()?
- Creating a Python list comprehension with an if and break
- Label in PyQt4 GUI not updating with every loop of FOR loop
- Strange result when removing item from a list while iterating over it in Python
- How can we force naming of parameters when calling a function?
- Why doesn’t modifying the iteration variable affect subsequent iterations?
- How to change variables fed into a for loop in list form
- Length of longest word in a list
- Stop PhpStorm from aligning associative arrays